OSDN Git Service

android-x86/external-llvm.git
7 years agoThe fix for PR22004: X86AsmParser.cpp asserts: OperandStack.size() > 1 && "Too few...
Andrew V. Tischenko [Fri, 26 May 2017 13:23:34 +0000 (13:23 +0000)]
The fix for PR22004: X86AsmParser.cpp asserts: OperandStack.size() > 1 && "Too few operands."

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

7 years agoRevert "[DWARF] - Make collectAddressRanges() return section index in addition to...
George Rimar [Fri, 26 May 2017 13:20:09 +0000 (13:20 +0000)]
Revert "[DWARF] - Make collectAddressRanges() return section index in addition to Low/High PC"

Broked BB again:

TEST 'LLVM :: DebugInfo/X86/dbg-value-regmask-clobber.ll' FAILED
...
LLVM ERROR: Section was outside of section table.

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

7 years agoRecommit r303978 "[DWARF] - Make collectAddressRanges() return section index in addit...
George Rimar [Fri, 26 May 2017 13:13:50 +0000 (13:13 +0000)]
Recommit r303978 "[DWARF] - Make collectAddressRanges() return section index in addition to Low/High PC"

With fix of test compilation.

Initial commit message:

This change is intended to use for LLD in D33183.
Problem we have in LLD when building .gdb_index is that we need to know section
which address range belongs to.

Previously it was solved on LLD side by providing fake section addresses
with use of llvm::LoadedObjectInfo interface. We assigned file offsets as addressed.
Then after obtaining ranges lists, for each range we had to find section ID's.
That not only was slow, but also complicated implementation and was the reason
of incorrect behavior when
sections share the same offsets, like D33176 shows.

This patch makes DWARF parsers to return section index as well.
That solves problem mentioned above.

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

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

7 years agoRevert r303978 "[DWARF] - Make collectAddressRanges() return section index in additio...
George Rimar [Fri, 26 May 2017 12:53:41 +0000 (12:53 +0000)]
Revert r303978 "[DWARF] - Make collectAddressRanges() return section index in addition to Low/High PC"

It failed BB.

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

7 years agoFix signedness of constant. NFC.
Nirav Dave [Fri, 26 May 2017 12:53:10 +0000 (12:53 +0000)]
Fix signedness of constant. NFC.

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

7 years agoExport the required symbol from DynamicLibraryTests
Roger Ferrer Ibanez [Fri, 26 May 2017 12:51:12 +0000 (12:51 +0000)]
Export the required symbol from DynamicLibraryTests

Running unittests/Support/DynamicLibrary/DynamicLibraryTests fails when LLVM is
configured with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON, because the test's version
script only contains symbols extracted from the static libraries, that the test
links with, but not those from the main object/executable itself. The patch
explicitly exports the one symbol needed by the test.

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

Patch authored by Momchil Velikov.

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

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

7 years ago[DWARF] - Make collectAddressRanges() return section index in addition to Low/High PC
George Rimar [Fri, 26 May 2017 12:46:41 +0000 (12:46 +0000)]
[DWARF] - Make collectAddressRanges() return section index in addition to Low/High PC

This change is intended to use for LLD in D33183.
Problem we have in LLD when building .gdb_index is that we need to know section
which address range belongs to.

Previously it was solved on LLD side by providing fake section addresses
with use of llvm::LoadedObjectInfo interface. We assigned file offsets as addressed.
Then after obtaining ranges lists, for each range we had to find section ID's.
That not only was slow, but also complicated implementation and was the reason
of incorrect behavior when
sections share the same offsets, like D33176 shows.

This patch makes DWARF parsers to return section index as well.
That solves problem mentioned above.

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

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

7 years agoRemove unnecessary double-assignment triggering -Wsequence-point.
Daniel Jasper [Fri, 26 May 2017 12:07:12 +0000 (12:07 +0000)]
Remove unnecessary double-assignment triggering -Wsequence-point.

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

7 years agoRe-enable "[SCEV] Do not fold dominated SCEVUnknown into AddRecExpr start"
Max Kazantsev [Fri, 26 May 2017 06:47:04 +0000 (06:47 +0000)]
Re-enable "[SCEV] Do not fold dominated SCEVUnknown into AddRecExpr start"

The patch rL303730 was reverted because test lsr-expand-quadratic.ll failed on
many non-X86 configs with this patch. The reason of this is that the patch
makes a correctless fix that changes optimizer's behavior for this test.
Without the change, LSR was making an overconfident simplification basing on a
wrong SCEV. Apparently it did not need the IV analysis to do this. With the
change, it chose a different way to simplify (that wasn't so confident), and
this way required the IV analysis. Now, following the right execution path,
LSR tries to make a transformation relying on IV Users analysis. This analysis
is target-dependent due to this code:

  // LSR is not APInt clean, do not touch integers bigger than 64-bits.
  // Also avoid creating IVs of non-native types. For example, we don't want a
  // 64-bit IV in 32-bit code just because the loop has one 64-bit cast.
  uint64_t Width = SE->getTypeSizeInBits(I->getType());
  if (Width > 64 || !DL.isLegalInteger(Width))
    return false;

To make a proper transformation in this test case, the type i32 needs to be
legal for the specified data layout. When the test runs on some non-X86
configuration (e.g. pure ARM 64), opt gets confused by the specified target
and does not use it, rejecting the specified data layout as well. Instead,
it uses some default layout that does not treat i32 as a legal type
(currently the layout that is used when it is not specified does not have
legal types at all). As result, the transformation we expect to happen does
not happen for this test.

This re-enabling patch does not have any source code changes compared to the
original patch rL303730. The only difference is that the failing test is
moved to X86 directory and now has requirement of running on x86 only to comply
with the specified target triple and data layout.

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

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

7 years agoLivePhysRegs: Skip reserved regs in computeLiveIns; NFCI
Matthias Braun [Fri, 26 May 2017 06:32:31 +0000 (06:32 +0000)]
LivePhysRegs: Skip reserved regs in computeLiveIns; NFCI

Re-commit r303937 + r303949 as they were not the cause for the build
failures.

We do not track liveness of reserved registers so adding them to the
liveins list in computeLiveIns() was completely unnecessary.

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

7 years agoRevert rL303923 since it broke the sanitizer bootstrap build bot.
Wei Mi [Fri, 26 May 2017 05:42:50 +0000 (05:42 +0000)]
Revert rL303923 since it broke the sanitizer bootstrap build bot.

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

7 years ago[InstSimplify] Use APInt::isMask isntead of manually implementing it. NFC
Craig Topper [Fri, 26 May 2017 05:16:22 +0000 (05:16 +0000)]
[InstSimplify] Use APInt::isMask isntead of manually implementing it. NFC

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

7 years ago[InstSimplify] Use m_ConstantInt matchers to short some code. NFC
Craig Topper [Fri, 26 May 2017 05:16:20 +0000 (05:16 +0000)]
[InstSimplify] Use m_ConstantInt matchers to short some code. NFC

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

7 years ago[IR] Add an iterator and range accessor for the PHI nodes of a basic
Chandler Carruth [Fri, 26 May 2017 03:10:00 +0000 (03:10 +0000)]
[IR] Add an iterator and range accessor for the PHI nodes of a basic
block.

This allows writing much more natural and readable range based for loops
directly over the PHI nodes. It also takes advantage of the same tricks
for terminating the sequence as the hand coded versions.

I've replaced one example of this mostly to showcase the difference and
I've added a unit test to make sure the facilities really work the way
they're intended. I want to use this inside of SimpleLoopUnswitch but it
seems generally nice.

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

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

7 years agoRevert "LivePhysRegs: Fix addLiveOutsNoPristines() for return blocks past PEI"
Matthias Braun [Fri, 26 May 2017 02:25:20 +0000 (02:25 +0000)]
Revert "LivePhysRegs: Fix addLiveOutsNoPristines() for return blocks past PEI"

Tentatively revert this to see if it fixes the buildbot stage2
breakages.

This reverts commit r303938.
This reverts commit r303954.

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

7 years agoRevert "LivePhysRegs: Skip reserved regs in computeLiveIns; NFCI"
Matthias Braun [Fri, 26 May 2017 01:29:32 +0000 (01:29 +0000)]
Revert "LivePhysRegs: Skip reserved regs in computeLiveIns; NFCI"

Tentatively revert, suspecting that it caused breakage in stage2
buildbots.

This reverts commit r303949.
This reverts commit r303937.

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

7 years agoTest for r303938
Matthias Braun [Fri, 26 May 2017 01:29:25 +0000 (01:29 +0000)]
Test for r303938

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

7 years ago[PM] Enable the new simple loop unswitch pass in the new pass manager
Chandler Carruth [Fri, 26 May 2017 01:24:11 +0000 (01:24 +0000)]
[PM] Enable the new simple loop unswitch pass in the new pass manager
(where it is the only realistic option).

This passes the LLVM test suite for me, but I'm clearly still hammering
on this.

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

7 years agoTidy up RelocVisitor.h.
Rui Ueyama [Fri, 26 May 2017 00:58:21 +0000 (00:58 +0000)]
Tidy up RelocVisitor.h.

Summary:
RelocVisitor had too many, too small functions. This patch group them
by architecture rather than each relocation type.

Reviewers: grimar, dblaikie

Subscribers: llvm-commits

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

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

7 years agoLivePhysRegs: Follow-up to r303937
Matthias Braun [Fri, 26 May 2017 00:54:24 +0000 (00:54 +0000)]
LivePhysRegs: Follow-up to r303937

We may have situations in which a superregister is reserved and not
added to liveins, so we have to add the subregisters.

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

7 years ago[llvm-pdbdump] Don't crash when displaying padding.
Zachary Turner [Fri, 26 May 2017 00:15:15 +0000 (00:15 +0000)]
[llvm-pdbdump] Don't crash when displaying padding.

We have a lot of complicated logic to determine where padding
is in a record, and the debug info doesn't always provide enough
information to figure it out with laser precision.  In this case
we were putting the padding in the wrong place causing an
out of bounds access on a BitVector.

Right now we decide that any trailing padding of a child type
will be truncated during record layout, but this is only true
insofar as the class still is sized properly to end on an
alignment boundary, which the algorithm doesn't yet know about.

For now, just don't crash, even though we display padding twice
in this case.

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

7 years ago[Examples] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Fri, 26 May 2017 00:00:14 +0000 (00:00 +0000)]
[Examples] 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@303944 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReturn a lit.Test.Result object from TestRunner's executeShTest()
Dimitry Andric [Thu, 25 May 2017 23:56:44 +0000 (23:56 +0000)]
Return a lit.Test.Result object from TestRunner's executeShTest()

Summary:
For various clang analyzer tests, which were unsupported, I got lit
exceptions, similar to the following:

    Exception during script execution:
    Traceback (most recent call last):
      File "utils/lit/lit/run.py", line 190, in execute_test
        result = test.config.test_format.execute(test, lit_config)
      File "tools/clang/test/Analysis/analyzer_test.py", line 11, in execute
        if result.code == lit.Test.FAIL:
    AttributeError: 'tuple' object has no attribute 'code'

This is because executeShTest() in utils/lit/lit/TestRunner.py is
supposed to return a lit.Test.Result object, but in case of unsupported
tests, it returns a plain tuple.

Fix this by returning a properly initialized lit.Test.Result object
instead.

Reviewers: rnk, rafael, modocache

Subscribers: llvm-commits

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

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

7 years agoRemove unused member.
Zachary Turner [Thu, 25 May 2017 23:47:56 +0000 (23:47 +0000)]
Remove unused member.

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

7 years ago[PPC] Add text for assert.
Tim Shen [Thu, 25 May 2017 23:40:46 +0000 (23:40 +0000)]
[PPC] Add text for assert.

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

7 years agoLTO: Do summary-based prevailing symbol resolution at --lto-O0.
Peter Collingbourne [Thu, 25 May 2017 23:40:11 +0000 (23:40 +0000)]
LTO: Do summary-based prevailing symbol resolution at --lto-O0.

Prevailing symbol resolution is necessary for correctness. Without
this we can end up dropping a referenced linkonce symbol from the link.

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

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

7 years agoLivePhysRegs: Fix addLiveOutsNoPristines() for return blocks past PEI
Matthias Braun [Thu, 25 May 2017 23:39:40 +0000 (23:39 +0000)]
LivePhysRegs: Fix addLiveOutsNoPristines() for return blocks past PEI

- addLiveOutsNoPristines() needs to add callee saved registers that are
  actually saved and restored somewhere to the set (they are not
  pristine).
- Cleanup/rewrite the code for addLiveOuts()/addLiveOutsNoPristines().

This fixes the problem from D32156.

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

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

7 years agoLivePhysRegs: Skip reserved regs in computeLiveIns; NFCI
Matthias Braun [Thu, 25 May 2017 23:39:33 +0000 (23:39 +0000)]
LivePhysRegs: Skip reserved regs in computeLiveIns; NFCI

We do not track liveness of reserved registers so adding them to the
liveins list in computeLiveIns() was completely unnecessary.

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

7 years ago[CV Type Merging] Find nested type indices faster.
Zachary Turner [Thu, 25 May 2017 23:36:16 +0000 (23:36 +0000)]
[CV Type Merging] Find nested type indices faster.

Merging two type streams is one of the most time consuming
parts of generating a PDB, and as such it needs to be as
fast as possible.  The visitor abstractions used for interoperating
nicely with many different types of inputs and outputs have
been used widely and help greatly for testability and implementing
tools, but the abstractions build up and get in the way of
performance.

This patch removes all of the visitation stuff from the type
stream merger, essentially re-inventing the leaf / member switch
and loop, but at a very low level.  This allows us many other
optimizations, such as not actually deserializing *any* records
(even member records which don't describe their own length), as
the operation of "figure out how long this record is" is somewhat
faster than "figure out how long this record *and* get all its
fields out".  Furthermore, whereas before we had to deserialize,
re-write type indices, then re-serialize, now we don't have to
do any of those 3 steps.  We just find out where the type indices
are and pull them directly out of the byte stream and re-write
them.

This is worth a 50-60% performance increase.  On top of all other
optimizations that have been applied this week, I now get the
following numbers when linking lld.exe and lld.pdb

MSVC: 25.67s
Before This Patch: 18.59s
After This Patch: 8.92s

So this is a huge performance win.

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

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

7 years agoDebugInfo: Simplify scopes+subprogram handling since the subprogram<>cu link inversion
David Blaikie [Thu, 25 May 2017 23:11:28 +0000 (23:11 +0000)]
DebugInfo: Simplify scopes+subprogram handling since the subprogram<>cu link inversion

Previously this code was defensive to the situation in which the debug
info scopes would lead to a different subprogram from the subprogram in
the CU's subprogram list (this could've happened with linkonce
functions, etc as per the comment being removed). Since the CU<>SP link
reversal this is no longer possible.

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

7 years ago[PPC] Fix atomics lowering in DAG lowering.
Tim Shen [Thu, 25 May 2017 22:58:35 +0000 (22:58 +0000)]
[PPC] Fix atomics lowering in DAG lowering.

I forgot to forward the chain, causing some missing instruction
dependencies. The test crashes the compiler without this patch.

Inspired by the test case, D33519 also tries to remove the extra sync.

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

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

7 years agoFix test to handle running on platforms which don't enable pubnames at all
David Blaikie [Thu, 25 May 2017 22:10:51 +0000 (22:10 +0000)]
Fix test to handle running on platforms which don't enable pubnames at all

Check that there are no entries in the pub sections, but that they may
either be not present or present-but-empty.

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

7 years ago[InstCombine] Add an InstCombine specific wrapper around isKnownToBeAPowerOfTwo to...
Craig Topper [Thu, 25 May 2017 21:51:12 +0000 (21:51 +0000)]
[InstCombine] Add an InstCombine specific wrapper around isKnownToBeAPowerOfTwo to shorten code. NFC

We have wrappers for several other ValueTracking methods that take care of passing all of the analysis and assumption cache parameters. This extends it to isKnownToBeAPowerOfTwo.

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

7 years ago[GVN] Add phi-translate support in scalarpre.
Wei Mi [Thu, 25 May 2017 21:49:02 +0000 (21:49 +0000)]
[GVN] Add phi-translate support in scalarpre.

Right now scalarpre doesn't have phi-translate support, so it will miss some
simple pre opportunities. Like the following testcase, current scalarpre cannot
recognize the last "a * b" is fully redundent because a and b used by the last
"a * b" expr are both defined by phis.

  long a[100], b[100], g1, g2, g3;
  __attribute__((pure)) long goo();

  void foo(long a, long b, long c, long d) {
    g1 = a * b;
    if (__builtin_expect(g2 > 3, 0)) {
      a = c;
      b = d;
      g2 = a * b;
    }
    g3 = a * b;      // fully redundant.
  }

The patch adds phi-translate support in scalarpre. This is only a temporary
solution before the newpre based on newgvn is available.

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

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

7 years agoAdd constrained intrinsics for some libm-equivalent operations
Andrew Kaylor [Thu, 25 May 2017 21:31:00 +0000 (21:31 +0000)]
Add constrained intrinsics for some libm-equivalent operations

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

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

7 years agoCodeGen: Rename DEBUG_TYPE to match passnames
Matthias Braun [Thu, 25 May 2017 21:26:32 +0000 (21:26 +0000)]
CodeGen: Rename DEBUG_TYPE to match passnames

Rename the DEBUG_TYPE to match the names of corresponding passes where
it makes sense. Also establish the pattern of simply referencing
DEBUG_TYPE instead of repeating the passname where possible.

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

7 years ago[lld] Fix a bug where we continually re-follow type servers.
Zachary Turner [Thu, 25 May 2017 21:16:03 +0000 (21:16 +0000)]
[lld] Fix a bug where we continually re-follow type servers.

Originally this was intended to be set up so that when linking
a PDB which refers to a type server, it would only visit the
PDB once, and on subsequent visitations it would just skip it
since all the records had already been added.

Due to some C++ scoping issues, this was not occurring and it
was revisiting the type server every time, which caused every
record to end up being thrown away on all subsequent visitations.

This doesn't affect the performance of linking clang-cl generated
object files because we don't use type servers, but when linking
object files and libraries generated with /Zi via MSVC, this means
only 1 object file has to be linked instead of N object files, so
the speedup is quite large.

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

7 years ago[CodeView Type Merging] Don't keep re-allocating temp serializer.
Zachary Turner [Thu, 25 May 2017 21:15:37 +0000 (21:15 +0000)]
[CodeView Type Merging] Don't keep re-allocating temp serializer.

Previously, every time we wanted to serialize a field list record, we
would create a new copy of FieldListRecordBuilder, which would in turn
create a temporary instance of TypeSerializer, which itself had a
std::vector<> that was about 128K in size. So this 128K allocation was
happening every time. We can re-use the same instance over and over, we
just have to clear its internal hash table and seen records list between
each run. This saves us from the constant re-allocations.

This is worth an ~18.5% speed increase (3.75s -> 3.05s) in my tests.

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

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

7 years agoMake BinaryStreamReader::readCString a bit faster.
Zachary Turner [Thu, 25 May 2017 21:12:27 +0000 (21:12 +0000)]
Make BinaryStreamReader::readCString a bit faster.

Previously it would do a character by character search for a null
terminator, to account for the fact that an arbitrary stream need not
store its data contiguously so you couldn't just do a memchr. However, the
stream API has a function which will return the longest contiguous chunk
without doing a copy, and by using this function we can do a memchr on the
individual chunks. For certain types of streams like data from object
files etc, this is guaranteed to find the null terminator with only a
single memchr, but even with discontiguous streams such as
MappedBlockStream, it's rare that any given string will cross a block
boundary, so even those will almost always be satisfied with a single
memchr.

This optimization is worth a 10-12% reduction in link time (4.2 seconds ->
3.75 seconds)

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

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

7 years ago[pdb] pad source file name buffer at the end instead of the beginning
Bob Haarman [Thu, 25 May 2017 21:12:15 +0000 (21:12 +0000)]
[pdb] pad source file name buffer at the end instead of the beginning

Summary:
DbiStreamBuilder calculated the offset of the source file names inside
the file info substream as the size of the file info substream minus
the size of the file names. Since the file info substream is padded to
a multiple of 4 bytes, this caused the first file name to be aligned
on a 4-byte boundary. By contrast, DbiModuleList would read the file
names immediately after the file name offset table, without skipping
to the next 4-byte boundary. This change makes it so that the file
names are written to the location where DbiModuleList expects them,
and puts any necessary padding for the file info substream after the
file names instead of before it.

Reviewers: amccarth, rnk, zturner

Reviewed By: amccarth, zturner

Subscribers: llvm-commits

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

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

7 years agoFix a bug in MappedBlockStream.
Zachary Turner [Thu, 25 May 2017 21:12:00 +0000 (21:12 +0000)]
Fix a bug in MappedBlockStream.

It was using the number of blocks of the entire PDB file as the number
of blocks of each stream that was created.  This was only an issue in
the readLongestContiguousChunk function, which  was never called prior.
This bug surfaced when I updated an algorithm to use this function and
the algorithm broke.

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

7 years ago[WebAssembly] MC: Include unnamed data when writing wasm files
Sam Clegg [Thu, 25 May 2017 21:08:07 +0000 (21:08 +0000)]
[WebAssembly] MC: Include unnamed data when writing wasm files

Also, include global entries for all data symbols, not
just external ones, since these are referenced by the
relocation records.

Add a test case that includes unnamed data.

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

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

7 years ago[CodeView Type Merging] Avoid record deserialization when possible.
Zachary Turner [Thu, 25 May 2017 21:06:28 +0000 (21:06 +0000)]
[CodeView Type Merging] Avoid record deserialization when possible.

A profile shows the majority of time doing type merging is spent
deserializing records from sequences of bytes into friendly C++ structures
that we can easily access members of in order to find the type indices to
re-write.

Records are prefixed with their length, however, and most records have
type indices that appear at fixed offsets in the record. For these
records, we can save some cycles by just looking at the right place in the
byte sequence and re-writing the value, then skipping the record in the
type stream. This saves us from the costly deserialization of examining
every field, including potentially null terminated strings which are the
slowest, even though it was unnecessary to begin with.

In addition, we apply another optimization. Previously, after
deserializing a record and re-writing its type indices, we would
unconditionally re-serialize it in order to compute the hash of the
re-written record. This would result in an alloc and memcpy for every
record. If no type indices were re-written, however, this was an
unnecessary allocation. In this patch re-writing is made two phase. The
first phase discovers the indices that need to be rewritten and their new
values. This information is passed through to the de-duplication code,
which only copies and re-writes type indices in the serialized byte
sequence if at least one type index is different.

Some records have type indices which only appear after variable length
strings, or which have lists of type indices, or various other situations
that can make it tricky to make this optimization. While I'm not giving up
on optimizing these cases as well, for now we can get the easy cases out
of the way and lay the groundwork for more complicated cases later.

This patch yields another 50% speedup on top of the already large speedups
submitted over the past 2 days. In two tests I have run, I went from 9
seconds to 3 seconds, and from 16 seconds to 8 seconds.

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

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

7 years agoUpdate the documentation and CMake file for Visual Studio generators.
Aaron Ballman [Thu, 25 May 2017 21:01:30 +0000 (21:01 +0000)]
Update the documentation and CMake file for Visual Studio generators.

By default, CMake uses a 32-bit toolchain, even when on a 64-bit platform targeting a 64-bit build. However, due to the size of the binaries involved, this can cause linker instabilities (such as the linker running out of memory). Guide people to the correct solution to get CMake to use the native toolchain.

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

7 years agoPPC: Correct Size for GETtlsADDR
Kyle Butt [Thu, 25 May 2017 19:37:41 +0000 (19:37 +0000)]
PPC: Correct Size for GETtlsADDR

PPC::GETtlsADDR is lowered to a branch and a nop, by the assembly
printer. Its size was incorrectly marked as 4, correct it to 8. The
incorrect size can cause incorrect branch relaxation in
PPCBranchSelector under the right conditions.

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

7 years agoRevert r303859, CodeGen/AMDGPU/llvm.amdgcn.s.getpc.ll fails on bots.
Nico Weber [Thu, 25 May 2017 19:19:29 +0000 (19:19 +0000)]
Revert r303859, CodeGen/AMDGPU/llvm.amdgcn.s.getpc.ll fails on bots.

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

7 years ago[AArch64]: add 'a' inline asm operand modifier.
Manoj Gupta [Thu, 25 May 2017 19:07:57 +0000 (19:07 +0000)]
[AArch64]: add 'a' inline asm operand modifier.

Summary:
This is used in the Linux kernel, and effectively just means "print an
address". This brings back r193593.

Reviewed by: Renato Golin

Reviewers: t.p.northover, rengolin, richard.barton.arm, kristof.beyls

Subscribers: aemerson, javed.absar, llvm-commits, eraman

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

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

7 years agoFix SelectionDAGBuilder::getDbgValue to not expect DW_OP_deref on FI vars
Adrian Prantl [Thu, 25 May 2017 18:54:10 +0000 (18:54 +0000)]
Fix SelectionDAGBuilder::getDbgValue to not expect DW_OP_deref on FI vars

This fixes an oversight in r300522, which changed alloca
dbg.values to no longer emit a DW_OP_deref.

The array.ll testcase was regenerated from source.

Fixes PR33166:
https://bugs.llvm.org/show_bug.cgi?id=33166

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

7 years agoDelete an obsolete paragraph in LangRef.
Adrian Prantl [Thu, 25 May 2017 18:54:06 +0000 (18:54 +0000)]
Delete an obsolete paragraph in LangRef.

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

7 years agoDebugInfo: Produce debug_{gnu_}pub{names,types} entries when explicitly requested...
David Blaikie [Thu, 25 May 2017 18:50:28 +0000 (18:50 +0000)]
DebugInfo: Produce debug_{gnu_}pub{names,types} entries when explicitly requested, even in -gmlt or when empty

Turns out gold doesn't use the DW_AT_GNU_pubnames to decide whether to
parse the rest of the DIEs when building gdb-index. This causes gold to
trip over LLVM's output when there are DW_FORM_ref_addr present.

Gold does use the presence of a debug_gnu_pub{names,types} entry for the
CU to skip parsing the debug_info portion, so make sure that's included
even when empty (technically, when empty there couldn't be any ref_addr
anyway - it only came up when gmlt didn't produce any (even non-empty)
pubnames - but given what that reveals about gold's implementation, this
seems like a good thing to do for consistency).

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

7 years ago[llvm-pdbdump] [yaml2pdb] always include object file name in module info
Bob Haarman [Thu, 25 May 2017 18:04:17 +0000 (18:04 +0000)]
[llvm-pdbdump] [yaml2pdb] always include object file name in module info

Summary:
Previously, the yaml2pdb subcommand of llvm-pdbdump only
included object file names in module info if a module info stream was
present. This change makes it so that we include the object file name
even if there is no module info stream for the module. As a result,
running
llvm-pdbdump pdb2yaml -dbi-module-info original.pdb > original.yaml &&
llvm-pdbdump yaml2pdb -pdb=new.pdb original.yaml && llvm-pdbdump
pdb2yaml -dbi-module-info new.pdb > new.yaml now produces identical
original.yaml and new.yaml files.

Reviewers: amccarth, zturner

Reviewed By: zturner

Subscribers: fhahn, llvm-commits

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

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

7 years agoNewGVN: Fix PR 33119, PR 33129, due to regressed undef handling
Daniel Berlin [Thu, 25 May 2017 15:44:20 +0000 (15:44 +0000)]
NewGVN: Fix PR 33119, PR 33129, due to regressed undef handling
Fix PR33120 and others by eliminating self-cycles a different way.

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

7 years ago[InstCombine] Teach isAllocSiteRemovable to look through addrspacecasts
Artur Pilipenko [Thu, 25 May 2017 15:14:48 +0000 (15:14 +0000)]
[InstCombine] Teach isAllocSiteRemovable to look through addrspacecasts

Reviewed By: reames

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

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

7 years ago[InstCombine] make icmp-mul fold more efficient
Sanjay Patel [Thu, 25 May 2017 14:13:57 +0000 (14:13 +0000)]
[InstCombine] make icmp-mul fold more efficient

There's probably a lot more like this (see also comments in D33338 about responsibility),
but I suspect we don't usually get a visible manifestation.

Given the recent interest in improving InstCombine efficiency, another potential micro-opt
that could be repeated several times in this function: morph the existing icmp pred/operands
instead of creating a new instruction.

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

7 years ago[AMDGPU] add intrinsic for s_getpc
Tim Corringham [Thu, 25 May 2017 14:04:14 +0000 (14:04 +0000)]
[AMDGPU] add intrinsic for s_getpc

Summary: The s_getpc instruction is exposed as intrinsic llvm.amdgcn.s.getpc.

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

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

7 years ago[X86] Adding vpopcntd and vpopcntq instructions
Oren Ben Simhon [Thu, 25 May 2017 13:45:23 +0000 (13:45 +0000)]
[X86] Adding vpopcntd and vpopcntq instructions

AVX512_VPOPCNTDQ is a new feature set that was published by Intel.
The patch represents the LLVM side of the addition of two new intrinsic based instructions (vpopcntd and vpopcntq).

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

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

7 years ago[GVNSink] Pacify MSVC
James Molloy [Thu, 25 May 2017 13:14:10 +0000 (13:14 +0000)]
[GVNSink] Pacify MSVC

Don't convert an unsigned to a pointer for a sentinel, use a size_t instead.

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

7 years ago[GVNSink] Don't define operator<< in NDEBUG
James Molloy [Thu, 25 May 2017 13:11:18 +0000 (13:11 +0000)]
[GVNSink] Don't define operator<< in NDEBUG

Without debug macros enabled, the raw_ostream operator<< overload
is unused.

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

7 years ago[GVNSink] GVNSink pass
James Molloy [Thu, 25 May 2017 12:51:11 +0000 (12:51 +0000)]
[GVNSink] GVNSink pass

This patch provides an initial prototype for a pass that sinks instructions based on GVN information, similar to GVNHoist. It is not yet ready for commiting but I've uploaded it to gather some initial thoughts.

This pass attempts to sink instructions into successors, reducing static
instruction count and enabling if-conversion.
We use a variant of global value numbering to decide what can be sunk.
Consider:

[ %a1 = add i32 %b, 1  ]   [ %c1 = add i32 %d, 1  ]
[ %a2 = xor i32 %a1, 1 ]   [ %c2 = xor i32 %c1, 1 ]
                 \           /
           [ %e = phi i32 %a2, %c2 ]
           [ add i32 %e, 4         ]

GVN would number %a1 and %c1 differently because they compute different
results - the VN of an instruction is a function of its opcode and the
transitive closure of its operands. This is the key property for hoisting
and CSE.

What we want when sinking however is for a numbering that is a function of
the *uses* of an instruction, which allows us to answer the question "if I
replace %a1 with %c1, will it contribute in an equivalent way to all
successive instructions?". The (new) PostValueTable class in GVN provides this
mapping.

This pass has some shown really impressive improvements especially for codesize already on internal benchmarks, so I have high hopes it can replace all the sinking logic in SimplifyCFG.

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

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

7 years ago[PM] Teach the PGO instrumentation pasess to run GlobalDCE before
Chandler Carruth [Thu, 25 May 2017 07:15:09 +0000 (07:15 +0000)]
[PM] Teach the PGO instrumentation pasess to run GlobalDCE before
instrumenting code.

This is important in the new pass manager. The old pass manager's
inliner has a small DCE routine embedded within it. The new pass manager
relies on the actual GlobalDCE pass for this.

Without this patch, instrumentation profiling with the new PM results in
massive code bloat in the object files because the instrumentation
itself ends up preventing DCE from working to remove the code.

We should probably change the instrumentation (and/or DCE) so that we
can eliminate dead code even if instrumented, but we shouldn't even
spend the time generating instrumentation for that code so this still
seems like a good patch.

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

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

7 years ago[PM/Unswitch] Fix a bug in the domtree update logic for the new unswitch
Chandler Carruth [Thu, 25 May 2017 06:33:36 +0000 (06:33 +0000)]
[PM/Unswitch] Fix a bug in the domtree update logic for the new unswitch
pass.

The original logic only considered direct successors of the hoisted
domtree nodes, but that isn't really enough. If there are other basic
blocks that are completely within the subtree, their successors could
just as easily be impacted by the hoisting.

The more I think about it, the more I think the correct update here is
to hoist every block on the dominance frontier which has an idom in the
chain we hoist across. However, this is subtle enough that I'd
definitely appreciate some more eyes on it.

Sadly, if this is the correct algorithm, it requires computing a (highly
localized) dominance frontier. I've done this in the simplest (IE, least
code) way I could come up with, but that may be too naive. Suggestions
welcome here, dominance update algorithms are not an area I've studied
much, so I don't have strong opinions.

In good news, with this patch, turning on simple unswitch passes the
LLVM test suite for me with asserts enabled.

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

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

7 years ago[MVT] Fix the identation of the start of the MVT class. NFC
Craig Topper [Thu, 25 May 2017 06:15:05 +0000 (06:15 +0000)]
[MVT] Fix the identation of the start of the MVT class. NFC

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

7 years ago[SelectionDAG] Fix off by one in a compare in getOperationAction.
Craig Topper [Thu, 25 May 2017 05:38:40 +0000 (05:38 +0000)]
[SelectionDAG] Fix off by one in a compare in getOperationAction.

If Op is equal to array_lengthof, the lookup would be out of bounds, but we were only checking for greater than. I suspect nothing ever passes in the equal value because its a sentinel to mark the end of the builtin opcodes and not a real opcode.

So really this fix is just so that the code looks right and makes sense.

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

7 years ago[LegacyPM] Make the 'addLoop' method accept a loop to add rather than
Chandler Carruth [Thu, 25 May 2017 03:01:31 +0000 (03:01 +0000)]
[LegacyPM] Make the 'addLoop' method accept a loop to add rather than
having it internally allocate the loop.

This is a much more flexible API and necessary in the new loop unswitch
to reasonably support both new and old PMs in common code. It also just
seems like a cleaner separation of concerns.

NFC, this should just be a pure refactoring.

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

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

7 years agoFixed nondeterminism in RuleMatcher::emit.
Galina Kistanova [Thu, 25 May 2017 01:51:53 +0000 (01:51 +0000)]
Fixed nondeterminism in RuleMatcher::emit.

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

7 years ago[libFuzzer] Don't replace custom signal handlers.
Vitaly Buka [Thu, 25 May 2017 01:43:13 +0000 (01:43 +0000)]
[libFuzzer] Don't replace custom signal handlers.

Summary:
This allows to keep handlers installed by sanitizers.
In other cases third-party code can replace handlers after libFuzzer
initialization anyway.

Reviewers: kcc

Subscribers: llvm-commits

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

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

7 years agoFix coverage check for full post-dominator basic blocks.
George Karpenkov [Thu, 25 May 2017 01:41:46 +0000 (01:41 +0000)]
Fix coverage check for full post-dominator basic blocks.

Coverage instrumentation which does not instrument full post-dominators
and full-dominators may skip valid paths, as the reasoning for skipping
blocks may become circular.
This patch fixes that, by only skipping
full post-dominators with multiple predecessors, as such predecessors by
definition can not be full-dominators.

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

7 years ago[coroutines] CoroFrame.cpp conform to coding convention (s/repeat/Repeat) (NFC)
Gor Nishanov [Thu, 25 May 2017 01:07:10 +0000 (01:07 +0000)]
[coroutines] CoroFrame.cpp conform to coding convention (s/repeat/Repeat) (NFC)

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

7 years ago[coroutines] Relocate instructions that maybe spilled after coro.begin
Gor Nishanov [Thu, 25 May 2017 00:46:20 +0000 (00:46 +0000)]
[coroutines] Relocate instructions that maybe spilled after coro.begin

Summary:
Frontend generates store instructions after allocas, for example:

```
define i8* @f(i64 %this) "coroutine.presplit"="1" personality i32 0 {
entry:
  %this.addr = alloca i64
  store i64 %this, i64* %this.addr
  ..
  %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)

```
Such instructions may require spilling into coro.frame, but, coro-frame address is only available after coro.begin and thus needs to be moved after coro.begin.
The only instructions that should not be moved are the arguments of coro.begin and all of their operands.

Reviewers: GorNishanov, majnemer

Reviewed By: GorNishanov

Subscribers: llvm-commits, EricWF

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

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

7 years ago[PowerPC] Fix a performance bug for PPC::XXSLDWI.
Tony Jiang [Wed, 24 May 2017 23:48:29 +0000 (23:48 +0000)]
[PowerPC] Fix a performance bug for PPC::XXSLDWI.

There are some VectorShuffle Nodes in SDAG which can be selected to XXSLDWI
instruction, this patch recognizes them and does the selection to improve the
PPC performance.

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

7 years agoPrint symbols from COFF import libraries.
Rafael Espindola [Wed, 24 May 2017 23:40:36 +0000 (23:40 +0000)]
Print symbols from COFF import libraries.

This change allows llvm-nm to print symbols found in import libraries,
in part by allowing COFFImportFiles to be casted to SymbolicFiles.

Patch by Dave Lee!

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

7 years ago[CodeGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Wed, 24 May 2017 23:10:29 +0000 (23:10 +0000)]
[CodeGen] 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@303820 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[coroutines] Allow rematerialization upto 4 times. Remove incorrect assert
Gor Nishanov [Wed, 24 May 2017 23:01:02 +0000 (23:01 +0000)]
[coroutines] Allow rematerialization upto 4 times. Remove incorrect assert

Reviewers: majnemer

Subscribers: EricWF, llvm-commits

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

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

7 years ago[InstCombine] use m_APInt to allow icmp-mul-mul vector fold
Sanjay Patel [Wed, 24 May 2017 22:58:17 +0000 (22:58 +0000)]
[InstCombine] use m_APInt to allow icmp-mul-mul vector fold

The swapped operands in the first test is a manifestation of an
inefficiency for vectors that doesn't exist for scalars because
the IRBuilder checks for an all-ones mask for scalars, but not
vectors.

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

7 years ago[InstCombine] add tests for icmp eq (mul X, C), (mul Y, C); NFC
Sanjay Patel [Wed, 24 May 2017 22:36:14 +0000 (22:36 +0000)]
[InstCombine] add tests for icmp eq (mul X, C), (mul Y, C); NFC

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

7 years ago[InstCombine] move tests and use FileCheck; NFC
Sanjay Patel [Wed, 24 May 2017 21:48:25 +0000 (21:48 +0000)]
[InstCombine] move tests and use FileCheck; NFC

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

7 years ago[DAG] Prevent crashes when merging constant stores with high-bit set. NFC.
Nirav Dave [Wed, 24 May 2017 19:56:39 +0000 (19:56 +0000)]
[DAG] Prevent crashes when merging constant stores with high-bit set. NFC.

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

7 years ago[AArch64] Prevent nested ADDs from address calc in splitStoreSplat. NFC
Nirav Dave [Wed, 24 May 2017 19:55:49 +0000 (19:55 +0000)]
[AArch64] Prevent nested ADDs from address calc in splitStoreSplat. NFC

In preparation for late-stage store merging.

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

7 years agoRevert "Revert "Attempt to pacify ASan and UBSan reports in CrashRecovery tests""
Vitaly Buka [Wed, 24 May 2017 19:11:12 +0000 (19:11 +0000)]
Revert "Revert "Attempt to pacify ASan and UBSan reports in CrashRecovery tests""

This dependents on r303729 which was reverted.

This reverts commit r303783.

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

7 years ago[InstCombine] Merge together the SimplifyDemandedUseBits implementations for ZExt...
Craig Topper [Wed, 24 May 2017 18:40:25 +0000 (18:40 +0000)]
[InstCombine] Merge together the SimplifyDemandedUseBits implementations for ZExt and Trunc. NFC

While there avoid resizing the DemandedMask twice. Make a copy into a separate variable instead. This potentially removes an allocation on large bit widths.

With the use of the zextOrTrunc methods on APInt and KnownBits these can be made almost source identical. The only difference is the zero of the upper bits for ZExt. This is similar to how its done in computeKnownBits in ValueTracking.

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

7 years agoPrevent UBSan report in CrashRecovery tests
Vitaly Buka [Wed, 24 May 2017 18:11:57 +0000 (18:11 +0000)]
Prevent UBSan report in CrashRecovery tests
Reverted by mistake with r303783.

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

7 years agoRevert "Attempt to pacify ASan and UBSan reports in CrashRecovery tests"
Vitaly Buka [Wed, 24 May 2017 17:58:09 +0000 (17:58 +0000)]
Revert "Attempt to pacify ASan and UBSan reports in CrashRecovery tests"

It's not needed after r303729.

This reverts commit r303311.

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

7 years agoFix a couple of typos in memory intrinsic optimization output (NFC)
Teresa Johnson [Wed, 24 May 2017 17:55:25 +0000 (17:55 +0000)]
Fix a couple of typos in memory intrinsic optimization output (NFC)

s/instrinsic/intrinsic

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

7 years agoP9: D-form vector load/store. Differential Revision: https://reviews.llvm.org/D33248
Zaara Syeda [Wed, 24 May 2017 17:50:37 +0000 (17:50 +0000)]
P9: D-form vector load/store. Differential Revision: https://reviews.llvm.org/D33248

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

7 years ago[InstCombine] Use less bitwise operations to handle Instruction::SExt in SimplifyDema...
Craig Topper [Wed, 24 May 2017 17:33:30 +0000 (17:33 +0000)]
[InstCombine] Use less bitwise operations to handle Instruction::SExt in SimplifyDemandedUseBits. Other improvements.

The current code created a NewBits mask and used it as a mask several times. One of them just before a call to trunc making it unnecessary. A call to getActiveBits can get us the same information for the case. We also ORed with this mask later when we should have just sign extended the known bits.

We also called trunc on the guaranteed to be zero KnownZeros/Ones masks entering this code. Creating appropriately sized temporary APInts is probably better.

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

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

7 years agoMove machine-cse-physreg.mir to test/CodeGen/Thumb
Krzysztof Parzyszek [Wed, 24 May 2017 17:20:47 +0000 (17:20 +0000)]
Move machine-cse-physreg.mir to test/CodeGen/Thumb

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

7 years ago[InstSimplify] Simplify uadd/sadd/umul/smul with overflow intrinsics when the Zero...
Craig Topper [Wed, 24 May 2017 17:05:28 +0000 (17:05 +0000)]
[InstSimplify] Simplify uadd/sadd/umul/smul with overflow intrinsics when the Zero or Undef is on the LHS.

Summary: This code was migrated from InstCombine a few years ago. InstCombine had nearby code that would move Constants to the RHS for these, but InstSimplify doesn't have such code on this path.

Reviewers: spatel, majnemer, davide

Reviewed By: spatel

Subscribers: llvm-commits

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

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

7 years ago[ValueTracking] Convert most of the calls to computeKnownBits to use the version...
Craig Topper [Wed, 24 May 2017 16:53:07 +0000 (16:53 +0000)]
[ValueTracking] Convert most of the calls to computeKnownBits to use the version that returns the KnownBits object.

This continues the changes started when computeSignBit was replaced with this new version of computeKnowBits.

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

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

7 years ago[ValueTracking] Add OptimizationRemarkEmitter to the other signature for commuteKnown...
Craig Topper [Wed, 24 May 2017 16:53:03 +0000 (16:53 +0000)]
[ValueTracking] Add OptimizationRemarkEmitter to the other signature for commuteKnownBits.

This is needed for an upcoming patch.

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

7 years agoRevert r291254: [AArch64] Reduce vector insert/extract cost for Falkor
Matthew Simpson [Wed, 24 May 2017 16:48:39 +0000 (16:48 +0000)]
Revert r291254: [AArch64] Reduce vector insert/extract cost for Falkor

The default vector insert/extract cost is more profitable on Falkor than the
reduced cost.

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

7 years agoAdd some tips on benchmarking.
Rafael Espindola [Wed, 24 May 2017 16:39:12 +0000 (16:39 +0000)]
Add some tips on benchmarking.

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

7 years ago[AMDGPU] Prevent too large store merges in AMDGPU Subtargets. NFCI.
Nirav Dave [Wed, 24 May 2017 15:59:09 +0000 (15:59 +0000)]
[AMDGPU] Prevent too large store merges in AMDGPU Subtargets. NFCI.

Various address spaces on the SI and R600 subtargets have stricter
limits on memory access size that other address spaces. Use
canMergeStoresTo predicate to prevent the DAGCombiner from creating
these stores as they will be split up during legalization.

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

7 years ago[LV] Update type in cost model for scalarization
Matthew Simpson [Wed, 24 May 2017 15:26:15 +0000 (15:26 +0000)]
[LV] Update type in cost model for scalarization

For non-uniform instructions marked for scalarization, we should update
`VectorTy` when computing instruction costs to reflect the scalar type. In
addition to determining instruction costs, this type is also used to signal
that all instructions in the loop will be scalarized. This currently affects
memory instructions and non-pointer induction variables and their updates. (We
also mark GEPs scalar after vectorization, but their cost is computed together
with memory instructions.) For scalarized induction updates, this patch also
scales the scalar cost by the vectorization factor, corresponding to each
induction step.

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

7 years ago[MSP430] Fix PR33050: Don't use ADD16ri to lower FrameIndex.
Vadzim Dambrouski [Wed, 24 May 2017 15:08:30 +0000 (15:08 +0000)]
[MSP430] Fix PR33050: Don't use ADD16ri to lower FrameIndex.

Use ADDframe pseudo instruction instead.
This will fix machine verifier error, and will help to fix PR32146.

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

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

7 years ago[InstCombine] add tests to show potential missing folds; NFC
Sanjay Patel [Wed, 24 May 2017 14:56:51 +0000 (14:56 +0000)]
[InstCombine] add tests to show potential missing folds; NFC

As noted in https://bugs.llvm.org/show_bug.cgi?id=33138 and
the comments, there are multiple ways to view this. If we
choose not to solve this in InstCombine, these tests will
serve as documentation of that choice.

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

7 years agoRevert "AMDGPU: Fold CI-specific complex SMRD patterns into existing complex patterns"
Marek Olsak [Wed, 24 May 2017 14:53:50 +0000 (14:53 +0000)]
Revert "AMDGPU: Fold CI-specific complex SMRD patterns into existing complex patterns"

This reverts commit e065977c4b5f68ab845400b256f6a3822b1325fa.

It doesn't work. S_LOAD_DWORD_IMM_ci and friends aren't selected by any of
the patterns, so it was putting 32-bit literals into the 8-bit field.

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

7 years ago[InstCombine] add tests to document bitcast + bitwise-logic behavior; NFC
Sanjay Patel [Wed, 24 May 2017 14:21:31 +0000 (14:21 +0000)]
[InstCombine] add tests to document bitcast + bitwise-logic behavior; NFC

The solution for PR26702 ( https://bugs.llvm.org/show_bug.cgi?id=26702 )
added a canonicalization rule, but the minimal regression tests don't
demonstrate how that rule interacts with other folds.

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

7 years agoRevert "[SCEV] Do not fold dominated SCEVUnknown into AddRecExpr start"
Diana Picus [Wed, 24 May 2017 14:16:04 +0000 (14:16 +0000)]
Revert "[SCEV] Do not fold dominated SCEVUnknown into AddRecExpr start"

This reverts commit r303730 because it broke all the buildbots.

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

7 years ago[Hexagon] Fix comment in HexagonPacketizer::runOnMachineFunction
Krzysztof Parzyszek [Wed, 24 May 2017 13:43:42 +0000 (13:43 +0000)]
[Hexagon] Fix comment in HexagonPacketizer::runOnMachineFunction

Patch by Wei-Ren Chen.

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

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

7 years ago[LoopVectorizer] Let target prefer scalar addressing computations.
Jonas Paulsson [Wed, 24 May 2017 13:42:56 +0000 (13:42 +0000)]
[LoopVectorizer]  Let target prefer scalar addressing computations.

The loop vectorizer usually vectorizes any instruction it can and then
extracts the elements for a scalarized use. On SystemZ, all elements
containing addresses must be extracted into address registers (GRs). Since
this extraction is not free, it is better to have the address in a suitable
register to begin with. By forcing address arithmetic instructions and loads
of addresses to be scalar after vectorization, two benefits result:

* No need to extract the register
* LSR optimizations trigger (LSR isn't handling vector addresses currently)

Benchmarking show improvements on SystemZ with this new behaviour.

Any other target could try this by returning false in the new hook
prefersVectorizedAddressing().

Review: Renato Golin, Elena Demikhovsky, Ulrich Weigand
https://reviews.llvm.org/D32422

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