OSDN Git Service

android-x86/external-llvm.git
7 years ago[APInt] Add support for dividing or remainder by a uint64_t or int64_t.
Craig Topper [Fri, 19 May 2017 16:43:54 +0000 (16:43 +0000)]
[APInt] Add support for dividing or remainder by a uint64_t or int64_t.

Summary:
This patch adds udiv/sdiv/urem/srem/udivrem/sdivrem methods that can divide by a uint64_t. This makes division consistent with all the other arithmetic operations.

This modifies the interface of the divide helper method to work on raw arrays instead of APInts. This way we can pass the uint64_t in for the RHS without wrapping it in an APInt. This required moving all the Quotient and Remainder allocation handling up to the callers. For udiv/urem this was as simple as just creating the Quotient/Remainder with the right size when they were declared. For udivrem we have to rely on reallocate not changing the contents of the variable LHS or RHS is aliased with the Quotient or Remainder APInts. We also have to zero the upper bits of Remainder and Quotient that divide doesn't write to if lhsWords/rhsWords is smaller than the width.

I've update the toString method to use the new udivrem.

Reviewers: hans, dblaikie, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

7 years ago[AMDGPU][MC] Corrected disassembler to decode instructions with 2 literals
Dmitry Preobrazhensky [Fri, 19 May 2017 14:27:52 +0000 (14:27 +0000)]
[AMDGPU][MC] Corrected disassembler to decode instructions with 2 literals

See bug 32922: https://bugs.llvm.org//show_bug.cgi?id=32922

Reviewers: artem.tamazov, vpykhtin

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

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

7 years ago[LoopPredication] NFC. Extract LoopICmp struct and parseLoopICmp helper
Artur Pilipenko [Fri, 19 May 2017 14:02:46 +0000 (14:02 +0000)]
[LoopPredication] NFC. Extract LoopICmp struct and parseLoopICmp helper

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

7 years ago[LoopPredication] NFC. Extract LoopPredication::expandCheck helper
Artur Pilipenko [Fri, 19 May 2017 14:00:58 +0000 (14:00 +0000)]
[LoopPredication] NFC. Extract LoopPredication::expandCheck helper

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

7 years ago[LoopPredication] NFC. Extract CanExpand helper lambda
Artur Pilipenko [Fri, 19 May 2017 14:00:04 +0000 (14:00 +0000)]
[LoopPredication] NFC. Extract CanExpand helper lambda

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

7 years ago[LoopPredication] NFC. Add an early exit if there is no guards in the loop
Artur Pilipenko [Fri, 19 May 2017 13:59:34 +0000 (13:59 +0000)]
[LoopPredication] NFC. Add an early exit if there is no guards in the loop

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

7 years ago[AMDGPU][MC] Fixed bugs in export instruction
Dmitry Preobrazhensky [Fri, 19 May 2017 13:36:09 +0000 (13:36 +0000)]
[AMDGPU][MC] Fixed bugs in export instruction

See Bugs 33019, 33056:
  https://bugs.llvm.org//show_bug.cgi?id=33019
  https://bugs.llvm.org//show_bug.cgi?id=33056

Reviewers: artem.tamazov, vpykhtin

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

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

7 years ago[X86][AVX512] Make i1 illegal in the CodeGen
Guy Blank [Fri, 19 May 2017 12:35:15 +0000 (12:35 +0000)]
[X86][AVX512] Make i1 illegal in the CodeGen

This patch defines the i1 type as illegal in the X86 backend for AVX512.
For DAG operations on <N x i1> types (build vector, extract vector element, ...) i8 is used, and should be truncated/extended.
This should produce better scalar code for i1 types since GPRs will be used instead of mask registers.

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

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

7 years ago[globalisel][tablegen] Demote OptForSize/OptForMinSize/ForCodeSize to per-function...
Daniel Sanders [Fri, 19 May 2017 11:08:33 +0000 (11:08 +0000)]
[globalisel][tablegen] Demote OptForSize/OptForMinSize/ForCodeSize to per-function predicates.

Summary:
This causes them to be re-computed more often than necessary but resolves
objections that were raised post-commit on r301750.

Reviewers: qcolombet, ab, t.p.northover, rovka, kristof.beyls

Reviewed By: qcolombet

Subscribers: igorb, llvm-commits

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

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

7 years agoFix vector pass-through value being unused in IRBuilder::CreateMaskedGather
Amara Emerson [Fri, 19 May 2017 10:40:18 +0000 (10:40 +0000)]
Fix vector pass-through value being unused in IRBuilder::CreateMaskedGather

Also s/0/nullptr in the call site in LV.

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

7 years ago[GlobalISel] IRTranslator: Translate ConstantStruct
Volkan Keles [Fri, 19 May 2017 09:47:02 +0000 (09:47 +0000)]
[GlobalISel] IRTranslator: Translate ConstantStruct

Reviewers: qcolombet, ab, t.p.northover, aditya_nandakumar, dsanders

Reviewed By: qcolombet

Subscribers: rovka, kristof.beyls, javed.absar, igorb, llvm-commits

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

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

7 years ago[APInt] Use b.negate() in place of b = -std::move(b). NFCI
Craig Topper [Fri, 19 May 2017 07:37:25 +0000 (07:37 +0000)]
[APInt] Use b.negate() in place of b = -std::move(b). NFCI

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

7 years agoFix compilation failure.
Zachary Turner [Fri, 19 May 2017 06:25:09 +0000 (06:25 +0000)]
Fix compilation failure.

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

7 years agoRevert "[CodeView] Provide a common interface for type collections."
Zachary Turner [Fri, 19 May 2017 05:57:45 +0000 (05:57 +0000)]
Revert "[CodeView] Provide a common interface for type collections."

This is a squash of ~5 reverts of, well, pretty much everything
I did today.  Something is seriously broken with lit on Windows
right now, and as a result assertions that fire in tests are
triggering failures.  I've been breaking non-Windows bots all
day which has seriously confused me because all my tests have
been passing, and after running lit with -a to view the output
even on successful runs, I find out that the tool is crashing
and yet lit is still reporting it as a success!

At this point I don't even know where to start, so rather than
leave the tree broken for who knows how long, I will get this
back to green, and then once lit is fixed on Windows, hopefully
hopefully fix the remaining set of problems for real.

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

7 years agoDon't crash if someone tries to visit an empty type stream.
Zachary Turner [Fri, 19 May 2017 05:18:09 +0000 (05:18 +0000)]
Don't crash if someone tries to visit an empty type stream.

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

7 years ago[CodeView] Reduce memory usage in TypeSerializer.
Zachary Turner [Fri, 19 May 2017 04:56:48 +0000 (04:56 +0000)]
[CodeView] Reduce memory usage in TypeSerializer.

We were using a BumpPtrAllocator to allocate stable storage for
a record, then trying to insert that into a hash table.  If a
collision occurred, the bytes were never inserted and the
allocation was unnecessary.  At the cost of an extra hash
computation, check first if it exists, and only if it does do
we allocate and insert.

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

7 years ago[NewGVN] Delete the old store when we find congruent to a load.
Davide Italiano [Fri, 19 May 2017 04:06:10 +0000 (04:06 +0000)]
[NewGVN] Delete the old store when we find congruent to a load.

(or non-store, more in general). Fixes PR33086. Caught by the
store verifier.

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

7 years agoFix a broken test.
Zachary Turner [Fri, 19 May 2017 03:04:08 +0000 (03:04 +0000)]
Fix a broken test.

Similar to my previous fix, it turns out llvm-pdbdump has been
printing an incorrect value since the beginning of time, but
we didn't know it was incorrect.  Specifically, we were interpreting
a TypeIndex as referencing a type from the TPI stream when it
actually should come from the IPI stream.  So we were printing a
string that looked like a valid string, but was just from the
wrong place.

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

7 years agoRevert "[ADT] Fix some Clang-tidy modernize-use-using warnings; other minor fixes...
Adam Nemet [Fri, 19 May 2017 02:56:37 +0000 (02:56 +0000)]
Revert "[ADT] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC)."

This reverts commit r303383.

This breaks the modules-enabled macOS build with:

lib/Support/LockFileManager.cpp:86:7: error: declaration of 'gethostuuid' must be imported from module 'Darwin.POSIX.unistd' before it is required

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

7 years agoFix crasher in CodeView test.
Zachary Turner [Fri, 19 May 2017 00:56:39 +0000 (00:56 +0000)]
Fix crasher in CodeView test.

Apparently this was always broken, but previously we were more
graceful about it and we would print "unknown udt" if we couldn't
find the type index, whereas now we just segfault because we
assume it's valid.  But this exposed a real bug, which is that
we weren't looking in the right place.  So fix that, and also
fix this crash at the same time.

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

7 years agoLiveIntervalAnalysis: Fix missing case in pruneSubRegValues()
Matthias Braun [Fri, 19 May 2017 00:18:03 +0000 (00:18 +0000)]
LiveIntervalAnalysis: Fix missing case in pruneSubRegValues()

pruneSubRegValues() needs to remove subregister ranges starting at
instructions that later get removed by eraseInstrs(). It missed to check
one case in which eraseInstrs() would remove an instruction.

Fixes http://llvm.org/PR32688

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

7 years agoFix typo
Matthias Braun [Fri, 19 May 2017 00:17:59 +0000 (00:17 +0000)]
Fix typo

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

7 years agoFix another warning.
Zachary Turner [Thu, 18 May 2017 23:30:51 +0000 (23:30 +0000)]
Fix another warning.

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

7 years ago[NewGVN] Break infinite recursion in singleReachablePHIPath().
Davide Italiano [Thu, 18 May 2017 23:22:44 +0000 (23:22 +0000)]
[NewGVN] Break infinite recursion in singleReachablePHIPath().

We can have cycles between PHIs and this causes singleReachablePhi()
to call itself indefintely (until we run out of stack). The proper
solution would be that of computing SCCs, but it's not worth for
now, so just keep a visited set and give up when we find a cycle.
Thanks to Dan for the discussion/help with this.

Fixes PR33014.

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

7 years agoFix some build errors and warnings.
Zachary Turner [Thu, 18 May 2017 23:12:42 +0000 (23:12 +0000)]
Fix some build errors and warnings.

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

7 years ago[CodeView] Raise the source to ID map out of the TypeStreamMerger.
Zachary Turner [Thu, 18 May 2017 23:04:08 +0000 (23:04 +0000)]
[CodeView] Raise the source to ID map out of the TypeStreamMerger.

This map will be needed to rewrite symbol streams after re-writing
the corresponding type streams.

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

7 years ago[llvm-pdbdump] Add the ability to merge PDBs.
Zachary Turner [Thu, 18 May 2017 23:03:41 +0000 (23:03 +0000)]
[llvm-pdbdump] Add the ability to merge PDBs.

Merging PDBs is a feature that will be used heavily by
the linker.  The functionality already exists but does not
have deep test coverage because it's not easily exposed through
any tools.  This patch aims to address that by adding the
ability to merge PDBs via llvm-pdbdump.  It takes arbitrarily
many PDBs and outputs a single PDB.

Using this new functionality, a test is added for merging
type records.  Future patches will add the ability to merge
symbol records, module information, etc.

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

7 years ago[CodeView] Provide a common interface for type collections.
Zachary Turner [Thu, 18 May 2017 23:03:06 +0000 (23:03 +0000)]
[CodeView] Provide a common interface for type collections.

Right now we have multiple notions of things that represent collections of
types. Most commonly used are TypeDatabase, which is supposed to keep
mappings from TypeIndex to type name when reading a type stream, which
happens when reading PDBs. And also TypeTableBuilder, which is used to
build up a collection of types dynamically which we will later serialize
(i.e. when writing PDBs).

But often you just want to do some operation on a collection of types, and
you may want to do the same operation on any kind of collection. For
example, you might want to merge two TypeTableBuilders or you might want
to merge two type streams that you loaded from various files.

This dichotomy between reading and writing is responsible for a lot of the
existing code duplication and overlapping responsibilities in the existing
CodeView library classes. For example, after building up a
TypeTableBuilder with a bunch of type records, if we want to dump it we
have to re-invent a bunch of extra glue because our dumper takes a
TypeDatabase or a CVTypeArray, which are both incompatible with
TypeTableBuilder.

This patch introduces an abstract base class called TypeCollection which
is shared between the various type collection like things. Wherever we
previously stored a TypeDatabase& in some common class, we now store a
TypeCollection&.

The advantage of this is that all the details of how the collection are
implemented, such as lazy deserialization of partial type streams, is
completely transparent and you can just treat any collection of types the
same regardless of where it came from.

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

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

7 years ago[InstCombine] add more tests for xor-of-icmps; NFC
Sanjay Patel [Thu, 18 May 2017 22:47:57 +0000 (22:47 +0000)]
[InstCombine] add more tests for xor-of-icmps; NFC

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

7 years ago[NewGVN] Replace predicate info leftovers.
Davide Italiano [Thu, 18 May 2017 21:43:23 +0000 (21:43 +0000)]
[NewGVN] Replace predicate info leftovers.

This time with an additional fix, i.e. we remove the dead
@llvm.ssa.copy instruction.

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

7 years ago[ADT] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
Eugene Zelenko [Thu, 18 May 2017 21:27:11 +0000 (21:27 +0000)]
[ADT] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).

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

7 years ago[InstCombine] add helper to foldXorOfICmps(); NFCI
Sanjay Patel [Thu, 18 May 2017 20:53:16 +0000 (20:53 +0000)]
[InstCombine] add helper to foldXorOfICmps(); NFCI

Also, fix the old-style capitalization of the related functions
and move them to the 'private' section of the class since they
are just helpers of the visit* functions.

As shown in the post-commit comments for D32143, we are missing
folds for xor-of-icmps.

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

7 years ago[InstSimplify] Make m_Not work for xor -1, X
Craig Topper [Thu, 18 May 2017 20:27:32 +0000 (20:27 +0000)]
[InstSimplify] Make m_Not work for xor -1, X

Currently m_Not only works the canonical xor X, -1 form that InstCombine produces. InstSimplify can't rely on this canonicalization.

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

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

7 years agoRevert r303375 "LLVM_FALLTHROUGH instead of fall-through comment."
Rui Ueyama [Thu, 18 May 2017 20:18:24 +0000 (20:18 +0000)]
Revert r303375 "LLVM_FALLTHROUGH instead of fall-through comment."

This reverts commit r303375 since it didn't compile.

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

7 years agoLLVM_FALLTHROUGH instead of fall-through comment.
Galina Kistanova [Thu, 18 May 2017 20:01:52 +0000 (20:01 +0000)]
LLVM_FALLTHROUGH instead of fall-through comment.

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

7 years agoRevert r302938 "Add LiveRangeShrink pass to shrink live range within BB."
Hans Wennborg [Thu, 18 May 2017 18:50:05 +0000 (18:50 +0000)]
Revert r302938 "Add LiveRangeShrink pass to shrink live range within BB."

This also reverts follow-ups r303292 and r303298.

It broke some Chromium tests under MSan, and apparently also internal
tests at Google.

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

7 years agoUse existing helper. NFC.
Rafael Espindola [Thu, 18 May 2017 18:24:11 +0000 (18:24 +0000)]
Use existing helper. NFC.

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

7 years ago[InstSimplify] Add test cases for missing fold (A & B) | ~(A ^ B) -> ~(A ^ B).
Craig Topper [Thu, 18 May 2017 18:14:40 +0000 (18:14 +0000)]
[InstSimplify] Add test cases for missing fold (A & B) | ~(A ^ B) -> ~(A ^ B).

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

7 years agoReduce gcc-7 warnings by fall-through comments.
Galina Kistanova [Thu, 18 May 2017 17:53:47 +0000 (17:53 +0000)]
Reduce gcc-7 warnings by fall-through comments.

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

7 years ago[InstCombine] move test and use better checks; NFC
Sanjay Patel [Thu, 18 May 2017 17:48:07 +0000 (17:48 +0000)]
[InstCombine] move test and use better checks; NFC

Previously, this test was checking for 'or i1', but that was actually matched by 'xor i1'.

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

7 years ago[IR] De-virtualize ~Value to save a vptr
Reid Kleckner [Thu, 18 May 2017 17:24:10 +0000 (17:24 +0000)]
[IR] De-virtualize ~Value to save a vptr

Summary:
Implements PR889

Removing the virtual table pointer from Value saves 1% of RSS when doing
LTO of llc on Linux. The impact on time was positive, but too noisy to
conclusively say that performance improved. Here is a link to the
spreadsheet with the original data:

https://docs.google.com/spreadsheets/d/1F4FHir0qYnV0MEp2sYYp_BuvnJgWlWPhWOwZ6LbW7W4/edit?usp=sharing

This change makes it invalid to directly delete a Value, User, or
Instruction pointer. Instead, such code can be rewritten to a null check
and a call Value::deleteValue(). Value objects tend to have their
lifetimes managed through iplist, so for the most part, this isn't a big
deal.  However, there are some places where LLVM deletes values, and
those places had to be migrated to deleteValue.  I have also created
llvm::unique_value, which has a custom deleter, so it can be used in
place of std::unique_ptr<Value>.

I had to add the "DerivedUser" Deleter escape hatch for MemorySSA, which
derives from User outside of lib/IR. Code in IR cannot include MemorySSA
headers or call the MemoryAccess object destructors without introducing
a circular dependency, so we need some level of indirection.
Unfortunately, no class derived from User may have any virtual methods,
because adding a virtual method would break User::getHungOffOperands(),
which assumes that it can find the use list immediately prior to the
User object. I've added a static_assert to the appropriate OperandTraits
templates to help people avoid this trap.

Reviewers: chandlerc, mehdi_amini, pete, dberlin, george.burgess.iv

Reviewed By: chandlerc

Subscribers: krytarowski, eraman, george.burgess.iv, mzolotukhin, Prazek, nlewycky, hans, inglorion, pcc, tejohnson, dberlin, llvm-commits

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

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

7 years ago[LSR] Call canonicalize after we generate a new Formula in GenerateTruncates. Fix...
Wei Mi [Thu, 18 May 2017 17:21:22 +0000 (17:21 +0000)]
[LSR] Call canonicalize after we generate a new Formula in GenerateTruncates. Fix PR33077.

The testcase in PR33077 generates a LSR Use Formula with two SCEVAddRecExprs for the same
loop. Such uncommon formula will become non-canonical after GenerateTruncates adds sign
extension to the ScaledReg of the Formula, and it will break the assertion that every
Formula to be inserted is canonical.

The fix is to call canonicalize for the raw Formula generated by GenerateTruncates
before inserting it.

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

7 years ago[LegacyPassManager] Remove TargetMachine constructors
Francis Visoiu Mistrih [Thu, 18 May 2017 17:21:13 +0000 (17:21 +0000)]
[LegacyPassManager] Remove TargetMachine constructors

This provides a new way to access the TargetMachine through
TargetPassConfig, as a dependency.

The patterns replaced here are:

* Passes handling a null TargetMachine call
  `getAnalysisIfAvailable<TargetPassConfig>`.

* Passes not handling a null TargetMachine
  `addRequired<TargetPassConfig>` and call
  `getAnalysis<TargetPassConfig>`.

* MachineFunctionPasses now use MF.getTarget().

* Remove all the TargetMachine constructors.
* Remove INITIALIZE_TM_PASS.

This fixes a crash when running `llc -start-before prologepilog`.

PEI needs StackProtector, which gets constructed without a TargetMachine
by the pass manager. The StackProtector pass doesn't handle the case
where there is no TargetMachine, so it segfaults.

Related to PR30324.

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

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

7 years ago[git-llvm] Don't attempt to propget files that don't exist yet in SVN
Reid Kleckner [Thu, 18 May 2017 17:17:17 +0000 (17:17 +0000)]
[git-llvm] Don't attempt to propget files that don't exist yet in SVN

svn propget will fail halfway through, and the patch will fail to apply.

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

7 years agoFix some minor issues in PDB parsing library.
Zachary Turner [Thu, 18 May 2017 15:14:44 +0000 (15:14 +0000)]
Fix some minor issues in PDB parsing library.

1) Until now I'd never seen a valid PDB where the DBI stream and
   the PDB Stream disagreed on the "Age" field.  Because of that,
   we had code to assert that they matched.  Recently though I was
   given a PDB where they disagreed, so this assumption has proven
   to be incorrect.  Remove this check.

2) We were walking the entire list of hash values for types up front
   and then throwing away the values.  For large PDBs this was a
   significant slow down.  Remove this.

With this patch, I can dump the list of all compilands from a
1.5GB PDB file in just a few seconds.

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

7 years ago[JumpThreading] Dont RAUW condition incorrectly
Anna Thomas [Thu, 18 May 2017 13:12:18 +0000 (13:12 +0000)]
[JumpThreading] Dont RAUW condition incorrectly

Summary:
We have a bug when RAUWing the condition if experimental.guard or assumes is a use of that
condition. This is because LazyValueInfo may have used the guards/assumes to identify the
value of the condition at the end of the block. RAUW replaces the uses
at the guard/assume as well as uses before the guard/assume. Both of
these are incorrect.
For now, disable RAUW for conditions and fix the logic as a next
step: https://reviews.llvm.org/D33257

Reviewers: sanjoy, reames, trentxintong

Subscribers: llvm-commits

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

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

7 years ago[AMDGPU] SDWA operands should not intersect with potential MIs
Sam Kolton [Thu, 18 May 2017 12:12:03 +0000 (12:12 +0000)]
[AMDGPU] SDWA operands should not intersect with potential MIs

Summary:
There should be no intesection between SDWA operands and potential MIs. E.g.:
```
v_and_b32 v0, 0xff, v1 -> src:v1 sel:BYTE_0
v_and_b32 v2, 0xff, v0 -> src:v0 sel:BYTE_0
v_add_u32 v3, v4, v2
```
In that example it is possible that we would fold 2nd instruction into 3rd (v_add_u32_sdwa) and then try to fold 1st instruction into 2nd (that was already destroyed). So if SDWAOperand is also a potential MI then do not apply it.

Reviewers: vpykhtin, arsenm

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

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

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

7 years ago[MVT] add v1i1 MVT
Guy Blank [Thu, 18 May 2017 11:29:41 +0000 (11:29 +0000)]
[MVT] add v1i1 MVT

Adds the v1i1 MVT as a preparation for another commit (https://reviews.llvm.org/D32273)

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

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

7 years ago[GlobalISel][X86] G_ADD/G_SUB vector legalizer/selector support.
Igor Breger [Thu, 18 May 2017 11:10:56 +0000 (11:10 +0000)]
[GlobalISel][X86] G_ADD/G_SUB vector legalizer/selector support.

Summary: G_ADD/G_SUB vector legalizer/selector support.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, llvm-commits, kristof.beyls

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

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

7 years ago[X86][AVX512] Add 512-bit vector ctpop costs + tests
Simon Pilgrim [Thu, 18 May 2017 10:42:34 +0000 (10:42 +0000)]
[X86][AVX512] Add 512-bit vector ctpop costs + tests

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

7 years agoRe-commit: [globalisel][tablegen] Import rules containing intrinsic_wo_chain.
Daniel Sanders [Thu, 18 May 2017 10:33:36 +0000 (10:33 +0000)]
Re-commit: [globalisel][tablegen] Import rules containing intrinsic_wo_chain.

Summary:
As of this patch, 1018 out of 3938 rules are currently imported.

Depends on D32275

Reviewers: qcolombet, kristof.beyls, rovka, t.p.northover, ab, aditya_nandakumar

Reviewed By: qcolombet

Subscribers: dberris, igorb, llvm-commits

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

The previous commit failed on test-suite/Bitcode/simd_ops/AArch64_halide_runtime.bc
because isImmOperandEqual() assumed MO was a register operand and that's not
always true.

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

7 years ago[X86] Add explicit triple to test invocation
Zvi Rackover [Thu, 18 May 2017 09:32:56 +0000 (09:32 +0000)]
[X86] Add explicit triple to test invocation

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

7 years ago[SCEV][NFC] Remove duplication of isLoopInvariant code
Max Kazantsev [Thu, 18 May 2017 08:26:41 +0000 (08:26 +0000)]
[SCEV][NFC] Remove duplication of isLoopInvariant code

Replace two places that duplicate the code of isLoopInvariant method with
the invocation of this method.

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

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

7 years ago[DWARF] - Simplify RelocVisitor implementation.
George Rimar [Thu, 18 May 2017 08:25:11 +0000 (08:25 +0000)]
[DWARF] - Simplify RelocVisitor implementation.

We do not need to store relocation width field.
Patch removes relative code, that simplifies implementation.

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

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

7 years ago[lib/Object] - Fix build bot after r303331 "[lib/Object] - Minor API update for llvm...
George Rimar [Thu, 18 May 2017 08:14:43 +0000 (08:14 +0000)]
[lib/Object] - Fix build bot after r303331 "[lib/Object] - Minor API update for llvm::Decompressor".

Error was:
Decompressor.h:33:28: error: extra qualification â€˜llvm::object::Decompressor::’ on member â€˜resizeAndDecompress’ [-fpermissive]
   template <class T> Error Decompressor::resizeAndDecompress(T &Out) {

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

7 years ago[X86] Replace slow LEA instructions in X86
Lama Saba [Thu, 18 May 2017 08:11:50 +0000 (08:11 +0000)]
[X86] Replace slow LEA instructions in X86

  According to Intel's Optimization Reference Manual for SNB+:
  " For LEA instructions with three source operands and some specific situations, instruction latency has increased to 3 cycles, and must
    dispatch via port 1:
  - LEA that has all three source operands: base, index, and offset
  - LEA that uses base and index registers where the base is EBP, RBP,or R13
  - LEA that uses RIP relative addressing mode
  - LEA that uses 16-bit addressing mode "
  This patch currently handles the first 2 cases only.

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

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

7 years ago[lib/Object] - Minor API update for llvm::Decompressor.
George Rimar [Thu, 18 May 2017 08:00:01 +0000 (08:00 +0000)]
[lib/Object] - Minor API update for llvm::Decompressor.

I revisited Decompressor API (issue with it was triggered during D32865 review)
and found it is probably provides more then we really need.

Issue was about next method's signature:

Error decompress(SmallString<32> &Out);
It is too strict. At first I wanted to change it to decompress(SmallVectorImpl<char> &Out),
but then found it is still not flexible because sticks to SmallVector.

During reviews was suggested to use templating to simplify code. Patch do that.

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

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

7 years agoFix buildbot failure after rL303327: [BPI] Reduce the probability of unreachable...
Serguei Katkov [Thu, 18 May 2017 07:20:52 +0000 (07:20 +0000)]
Fix buildbot failure after rL303327: [BPI] Reduce the probability of unreachable edge to minimal value greater than 0.

One more test is updated to meet new branch probability for unreachable branches.

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

7 years ago[X86] Adding tests for scalar bitcasts from vsetcc. NFC.
Zvi Rackover [Thu, 18 May 2017 07:04:48 +0000 (07:04 +0000)]
[X86] Adding tests for scalar bitcasts from vsetcc. NFC.

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

7 years ago[BPI] Reduce the probability of unreachable edge to minimal value greater than 0
Serguei Katkov [Thu, 18 May 2017 06:11:56 +0000 (06:11 +0000)]
[BPI] Reduce the probability of unreachable edge to minimal value greater than 0

The probability of edge coming to unreachable block should be as low as possible.
The change reduces the probability to minimal value greater than zero.

The bug https://bugs.llvm.org/show_bug.cgi?id=32214 show the example when
the probability of edge coming to unreachable block is greater than for edge
coming to out of the loop and it causes incorrect loop rotation.

Please note that with this change the behavior of unreachable heuristic is a bit different
than others. Specifically, before this change the sum of probabilities
coming to unreachable blocks have the same weight for all branches
(it was just split over all edges of this block coming to unreachable blocks).
With this change it might be slightly different but not to much due to probability of
taken branch to unreachable block is really small.

Reviewers: chandlerc, sanjoy, vsk, congh, junbuml, davidxl, dexonsmith
Reviewed By: chandlerc, dexonsmith
Subscribers: reames, llvm-commits
Differential Revision: https://reviews.llvm.org/D30633

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

7 years ago[ThinLTO] Do not assert when adding a module with a different but
Akira Hatanaka [Thu, 18 May 2017 03:52:29 +0000 (03:52 +0000)]
[ThinLTO] Do not assert when adding a module with a different but
compatible target triple

Currently, an assertion fails in ThinLTOCodeGenerator::addModule when
the target triple of the module being added doesn't match that of the
one stored in TMBuilder. This patch relaxes the constraint and makes
changes to allow target triples that only differ in their version
numbers on Apple platforms, similarly to what r228999 did.

rdar://problem/30133904

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

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

7 years ago[Target/X86] Remove unneeded return. NFCI.
Davide Italiano [Thu, 18 May 2017 02:36:42 +0000 (02:36 +0000)]
[Target/X86] Remove unneeded return. NFCI.

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

7 years agoUpdate three tests I missed in r302979 and r302990
Justin Bogner [Thu, 18 May 2017 00:58:06 +0000 (00:58 +0000)]
Update three tests I missed in r302979 and r302990

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

7 years ago[Statistics] Add a method to atomically update a statistic that contains a maximum
Craig Topper [Thu, 18 May 2017 00:51:39 +0000 (00:51 +0000)]
[Statistics] Add a method to atomically update a statistic that contains a maximum

Summary:
There are several places in the codebase that try to calculate a maximum value in a Statistic object. We currently do this in one of two ways:

  MaxNumFoo = std::max(MaxNumFoo, NumFoo);

or

  MaxNumFoo = (MaxNumFoo > NumFoo) ? MaxNumFoo : NumFoo;

The first version reads from MaxNumFoo one time and uncontionally rwrites to it. The second version possibly reads it twice depending on the result of the first compare.  But we have no way of knowing if the value was changed by another thread between the reads and the writes.

This patch adds a method to the Statistic object that can ensure that we only store if our value is the max and the previous max didn't change after we read it. If it changed we'll recheck if our value should still be the max or not and try again.

This spawned from an audit I'm trying to do of all places we uses the implicit conversion to unsigned on the Statistics objects. See my previous thread on llvm-dev https://groups.google.com/forum/#!topic/llvm-dev/yfvxiorKrDQ

Reviewers: dberlin, chandlerc, hfinkel, dblaikie

Reviewed By: chandlerc

Subscribers: llvm-commits, sanjoy

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

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

7 years agoCodeGen: BlockPlacement: Add Message strings to asserts. NFC
Kyle Butt [Wed, 17 May 2017 23:44:41 +0000 (23:44 +0000)]
CodeGen: BlockPlacement: Add Message strings to asserts. NFC

Add message strings to all the unlabeled asserts in the file.

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

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

7 years ago[InstCombine] add test for xor-of-icmps; NFC
Sanjay Patel [Wed, 17 May 2017 23:22:52 +0000 (23:22 +0000)]
[InstCombine] add test for xor-of-icmps; NFC

This is another form of the problem discussed in D32143.

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

7 years ago[Statistics] Use Statistic::operator+= instead of adding and assigning separately.
Craig Topper [Wed, 17 May 2017 23:22:10 +0000 (23:22 +0000)]
[Statistics] Use Statistic::operator+= instead of adding and assigning separately.

I believe this technically fixes a multithreaded race condition in this code. But my primary concern was as part of looking at removing the ability to treat Statistics like a plain unsigned. There are many weird operations on Statistics in the codebase.

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

7 years agoRevert "[globalisel][tablegen] Import rules containing intrinsic_wo_chain."
Quentin Colombet [Wed, 17 May 2017 23:17:29 +0000 (23:17 +0000)]
Revert "[globalisel][tablegen] Import rules containing intrinsic_wo_chain."

This reverts commit r303259.

This breaks the GISel bot:
http://lab.llvm.org:8080/green/job/Compiler_Verifiers_GlobalISEL/5163/consoleFull#-134276167849ba4694-19c4-4d7e-bec5-911270d8a58c

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

7 years ago[InstCombine] handle icmp i1 X, C early to avoid creating an unknown pattern
Sanjay Patel [Wed, 17 May 2017 22:29:40 +0000 (22:29 +0000)]
[InstCombine] handle icmp i1 X, C early to avoid creating an unknown pattern

The missing optimization for xor-of-icmps still needs to be added, but by
being more efficient (not generating unnecessary logic ops with constants)
we avoid the bug.

See discussion in post-commit comments:
https://reviews.llvm.org/D32143

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

7 years agoAttempt to pacify ASan and UBSan reports in CrashRecovery tests
Reid Kleckner [Wed, 17 May 2017 22:23:20 +0000 (22:23 +0000)]
Attempt to pacify ASan and UBSan reports in CrashRecovery tests

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

7 years ago[InstCombine] add test for missing icmp bool fold; NFC
Sanjay Patel [Wed, 17 May 2017 22:20:02 +0000 (22:20 +0000)]
[InstCombine] add test for missing icmp bool fold; NFC

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

7 years ago[InstCombine] move icmp bool canonicalizations to helper; NFC
Sanjay Patel [Wed, 17 May 2017 22:15:07 +0000 (22:15 +0000)]
[InstCombine] move icmp bool canonicalizations to helper; NFC

As noted in the post-commit comments in D32143, we should be
catching the constant operand cases sooner to be more efficient
and less likely to expose a missing fold.

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

7 years agoAMDGPU: Start defining a calling convention
Matt Arsenault [Wed, 17 May 2017 21:56:25 +0000 (21:56 +0000)]
AMDGPU: Start defining a calling convention

Partially implement callee-side for arguments and return values.
byval doesn't work properly, and most likely sret or other on-stack
return values most as well.

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

7 years agoCodeGen: Power: Add lowering for shifts of v1i128.
Kyle Butt [Wed, 17 May 2017 21:54:41 +0000 (21:54 +0000)]
CodeGen: Power: Add lowering for shifts of v1i128.

When legalizing vector operations on vNi128, they will be split to v1i128
because that is a legal type on ppc64, but then the compiler will crash in
selection dag because it fails to select for these operations. This patch fixes
shift operations. Logical shift right and left shift can be performed in the
vector unit, but algebraic shift right requires being split.

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

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

7 years agoFix PR33028
Michael Liao [Wed, 17 May 2017 21:48:00 +0000 (21:48 +0000)]
Fix PR33028

- '-verify-mahcineinstrs' starts to complain allocatable live-in physical
  registers on non-entry or non-landing-pad basic blocks.
- Refactor the XBEGIN translation to define EAX on a dedicated fallback code
  path due to XABORT. Add a pseudo instruction to define EAX explicitly to
  avoid add physical register live-in.

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

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

7 years agoAMDGPU: Remove old intrinsic uses
Matt Arsenault [Wed, 17 May 2017 21:38:21 +0000 (21:38 +0000)]
AMDGPU: Remove old intrinsic uses

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

7 years agoAMDGPU: Expand frame indexes to be relative to scratch wave offset
Matt Arsenault [Wed, 17 May 2017 21:23:14 +0000 (21:23 +0000)]
AMDGPU: Expand frame indexes to be relative to scratch wave offset

In order for an arbitrary callee to access an object
in a caller's stack frame, the 32-bit offset used as
the private pointer needs to be relative to the kernel's
scratch wave offset register.

Convert to this by finding the difference from the current
stack frame and scaling by the wavefront size.

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

7 years agoAMDGPU: Change mubuf soffset register when SP relative
Matt Arsenault [Wed, 17 May 2017 21:02:58 +0000 (21:02 +0000)]
AMDGPU: Change mubuf soffset register when SP relative

Check the MachinePointerInfo for whether the access is
supposed to be relative to the stack pointer.

No tests because this is used in later commits implementing
calls.

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

7 years ago[X86][AVX512] Add 512-bit vector ctlz costs + tests
Simon Pilgrim [Wed, 17 May 2017 21:02:18 +0000 (21:02 +0000)]
[X86][AVX512] Add 512-bit vector ctlz costs + tests

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

7 years ago[llvm-pdbdump] in yaml2pdb, generate default output filename if none given
Bob Haarman [Wed, 17 May 2017 20:46:48 +0000 (20:46 +0000)]
[llvm-pdbdump] in yaml2pdb, generate default output filename if none given

Summary:
llvm-pdbdump yaml2pdb used to fail with a misleading error
message ("An I/O error occurred on the file system") if no output file
was specified. This change adds an assert to PDBFileBuilder to check
that an output file name is specified, and makes llvm-pdbdump generate
an output file name based on the input file name if no output file
name is explicitly specified.

Reviewers: amccarth, zturner

Reviewed By: zturner

Subscribers: fhahn, llvm-commits

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

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

7 years agoupdate the test that should have been updated in r303292. (NFC)
Dehao Chen [Wed, 17 May 2017 20:44:08 +0000 (20:44 +0000)]
update the test that should have been updated in r303292. (NFC)

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

7 years agoAdd some helpers for manipulating BinaryStreamRefs.
Zachary Turner [Wed, 17 May 2017 20:42:52 +0000 (20:42 +0000)]
Add some helpers for manipulating BinaryStreamRefs.

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

7 years agoAMDGPU: Make better use of op_sel with high components
Matt Arsenault [Wed, 17 May 2017 20:30:58 +0000 (20:30 +0000)]
AMDGPU: Make better use of op_sel with high components

Handle more general swizzles.

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

7 years ago[InstSimplify] handle all icmp i1 X, C in one place; NFCI
Sanjay Patel [Wed, 17 May 2017 20:27:55 +0000 (20:27 +0000)]
[InstSimplify] handle all icmp i1 X, C in one place; NFCI

We already handled all of the new tests identically, but several
of those went through a lot of unnecessary processing before
getting folded.

Another motivation for grouping these cases together is that
InstCombine needs a similar fold. Currently, it handles the
'not' cases inefficiently which can lead to bugs as described
in the post-commit comments of:
https://reviews.llvm.org/D32143

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

7 years ago[BinaryStream] Reduce the amount of boiler plate needed to use.
Zachary Turner [Wed, 17 May 2017 20:23:31 +0000 (20:23 +0000)]
[BinaryStream] Reduce the amount of boiler plate needed to use.

Often you have an array and you just want to use it.  With the current
design, you have to first construct a `BinaryByteStream`, and then create
a `BinaryStreamRef` from it.  Worse, the `BinaryStreamRef` holds a pointer
to the `BinaryByteStream`, so you can't just create a temporary one to
appease the compiler, you have to actually hold onto both the `ArrayRef`
as well as the `BinaryByteStream` *AND* the `BinaryStreamReader` on top of
that.  This makes for very cumbersome code, often requiring one to store a
`BinaryByteStream` in a class just to circumvent this.

At the cost of some added complexity (not exposed to users, but internal
to the library), we can do better than this.  This patch allows us to
construct `BinaryStreamReaders` and `BinaryStreamWriters` directly from
source data (e.g. `StringRef`, `MutableArrayRef<uint8_t>`, etc).  Not only
does this reduce the amount of code you have to type and make it more
obvious how to use it, but it solves real lifetime issues when it's
inconvenient to hold onto a `BinaryByteStream` for a long time.

The additional complexity is in the form of an added layer of indirection.
Whereas before we simply stored a `BinaryStream*` in the ref, we now store
both a `BinaryStream*` **and** a `std::shared_ptr<BinaryStream>`.  When
the user wants to construct a `BinaryStreamRef` directly from an
`ArrayRef` etc, we allocate an internal object that holds ownership over a
`BinaryByteStream` and forwards all calls, and store this in the
`shared_ptr<>`.  This also maintains the ref semantics, as you can copy it
by value and references refer to the same underlying stream -- the one
being held in the object stored in the `shared_ptr`.

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

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

7 years ago[X86][AVX512] Add 512-bit vector cttz costs + tests
Simon Pilgrim [Wed, 17 May 2017 20:22:54 +0000 (20:22 +0000)]
[X86][AVX512] Add 512-bit vector cttz costs + tests

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

7 years agoOnly enable LiveRangeShrink for x86.
Dehao Chen [Wed, 17 May 2017 20:18:13 +0000 (20:18 +0000)]
Only enable LiveRangeShrink for x86.

Summary: Moving LiveRangeShrink to x86 as this pass is mostly useful for archtectures with great register pressure.

Reviewers: MatzeB, qcolombet

Reviewed By: qcolombet

Subscribers: jholewinski, jyknight, javed.absar, llvm-commits

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

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

7 years agoAMDGPU: Try to use op_sel when selecting packed instructions
Matt Arsenault [Wed, 17 May 2017 20:00:00 +0000 (20:00 +0000)]
AMDGPU: Try to use op_sel when selecting packed instructions

Avoids instructions to pack a vector when the source is really
a scalar being broadcast.

Also be smarter and look for per-component fneg.

Doesn't yet handle scalar from upper half of register
or other swizzles.

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

7 years ago[X86] Split ctpop/ctlz/cttz cost tests
Simon Pilgrim [Wed, 17 May 2017 19:57:20 +0000 (19:57 +0000)]
[X86] Split ctpop/ctlz/cttz cost tests

This will make things a lot easier to test all the permutations of avx512

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

7 years agoReapply part of rL303015, fixing just the DynamicLibaryTest. Add
Dimitry Andric [Wed, 17 May 2017 19:46:49 +0000 (19:46 +0000)]
Reapply part of rL303015, fixing just the DynamicLibaryTest.  Add
retrieval of the original argv[0] from the GoogleTest framework, so it
is more likely the correct main executable path is found.

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

7 years ago[WebAssembly][NFC] Update expected testsuite failures for newly passing tests
Jacob Gravelle [Wed, 17 May 2017 19:45:22 +0000 (19:45 +0000)]
[WebAssembly][NFC] Update expected testsuite failures for newly passing tests

Summary: r303050 fixes crashes when calling scalarizeMaskedMemIntrin pass from WebAssembly backend. This updates expected test failures for that.

Reviewers: sbc100

Subscribers: jfb, llvm-commits, dschuff

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

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

7 years agoAMDGPU: Use appropriate soffset for spilling
Matt Arsenault [Wed, 17 May 2017 19:37:57 +0000 (19:37 +0000)]
AMDGPU: Use appropriate soffset for spilling

This needs to be the frame offset register, and not the global
scratch wave offset register. For kernels, these are the same.

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

7 years agoRevert r303015, because it has the unintended side effect of breaking
Dimitry Andric [Wed, 17 May 2017 19:33:10 +0000 (19:33 +0000)]
Revert r303015, because it has the unintended side effect of breaking
driver-mode recognition in clang (this is because the sysctl method
always returns one and only one executable path, even for an executable
with multiple links):

Fix DynamicLibraryTest.cpp on FreeBSD and NetBSD

Summary:

After rL301562, on FreeBSD the DynamicLibrary unittests fail, because
the test uses getMainExecutable("DynamicLibraryTests", Ptr), and since
the path does not contain any slashes, retrieving the main executable
will not work.

Reimplement getMainExecutable() for FreeBSD and NetBSD using sysctl(3),
which is more reliable than fiddling with relative or absolute paths.

Also add retrieval of the original argv[] from the GoogleTest framework,
to use as a fallback for other OSes.

Reviewers: emaste, marsupial, hans, krytarowski

Reviewed By: krytarowski

Subscribers: krytarowski, llvm-commits

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

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

7 years agoAMDGPU: Fix min3/max3 combines for f16/i16
Matt Arsenault [Wed, 17 May 2017 19:25:06 +0000 (19:25 +0000)]
AMDGPU: Fix min3/max3 combines for f16/i16

Fix missing instruction definitions for min3/max3.

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

7 years ago[X86][AVX512] Add 512-bit vector bitreverse costs + tests
Simon Pilgrim [Wed, 17 May 2017 19:20:20 +0000 (19:20 +0000)]
[X86][AVX512] Add 512-bit vector bitreverse costs + tests

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

7 years agoAdd back a dummy --use-processes.
Rafael Espindola [Wed, 17 May 2017 18:55:01 +0000 (18:55 +0000)]
Add back a dummy --use-processes.

Some bots are using it.

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

7 years agoAlways use the multiprocess module.
Rafael Espindola [Wed, 17 May 2017 18:20:01 +0000 (18:20 +0000)]
Always use the multiprocess module.

This seems to work on freebsd and openbsd these days.

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

7 years agoRe-land r303274: "[CrashRecovery] Use SEH __try instead of VEH when available"
Reid Kleckner [Wed, 17 May 2017 18:16:17 +0000 (18:16 +0000)]
Re-land r303274: "[CrashRecovery] Use SEH __try instead of VEH when available"

We have to check gCrashRecoveryEnabled before using __try.

In other words, SEH works too well and we ended up recovering from
crashes in implicit module builds that we weren't supposed to. Only
libclang is supposed to enable CrashRecoveryContext to allow implicit
module builds to crash.

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

7 years ago[GISel]: Fix undefined behavior in IRTranslator
Aditya Nandakumar [Wed, 17 May 2017 17:41:55 +0000 (17:41 +0000)]
[GISel]: Fix undefined behavior in IRTranslator

Make sure IRTranslator->MachineIRBuilder->DebugLoc doesn't
outlive the DILocation. Clear it at the end of
IRTranslator::runOnMachineFunction

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

7 years agoRevert "[CrashRecovery] Use SEH __try instead of VEH when available"
Reid Kleckner [Wed, 17 May 2017 17:15:00 +0000 (17:15 +0000)]
Revert "[CrashRecovery] Use SEH __try instead of VEH when available"

This reverts commit r303274, it appears to break some clang tests.

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