1
0
mirror of https://github.com/RPCSX/llvm.git synced 2024-12-14 23:48:49 +00:00
Commit Graph

149358 Commits

Author SHA1 Message Date
Zachary Turner
d32a382ebb Resubmit "[CodeView] Provide a common interface for type collections."
This was originally reverted because it was a breaking a bunch
of bots and the breakage was not surfacing on Windows.  After much
head-scratching this was ultimately traced back to a bug in the
lit test runner related to its pipe handling.  Now that the bug
in lit is fixed, Windows correctly reports these test failures,
and as such I have finally (hopefully) fixed all of them in this
patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303446 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 19:26:58 +00:00
Davide Italiano
9484675111 [InstCombine] Add tests to demonstrate the miscompile in PR33078.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303445 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 19:23:24 +00:00
Daniel Berlin
c81a193613 Last of the major pieces to NewGVN - yay!
Summary:
NewGVN: Handle equivalence between phi of ops and op of phis.

This makes our GVN mostly-complete. It would be complete, modulo some
deliberate choices we make.  This means it detects roughly all herband
equivalences in polynomial time, including cases notoriously hard for
other GVN's to detect.  It also detects a very large swath of the
cases we currently rely on instcombine to detect that involve folding
upwards through phis.

Fixes PR 31125, 31463, PR 31868

Reviewers: davide

Subscribers: Prazek, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303444 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 19:01:27 +00:00
Daniel Berlin
f3e0e87774 NewGVN: Get rid of most dominating leader check
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303443 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 19:01:24 +00:00
Daniel Berlin
a55349e67c BasicAA: Uninserted instructions have no parent, and notDifferentParent explicitly allows for this case, but getParent crashes when handed one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303442 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 19:01:21 +00:00
Amaury Sechet
04150ba0ac [DAGCombine] (addcarry 0, 0, X) -> (ext/trunc X)
Summary:
While this makes some case better and some case worse - so it's unclear if it is a worthy combine just by itself - this is a useful canonicalisation.

As per discussion in D32756 .

Reviewers: jyknight, nemanjai, mkuper, spatel, RKSimon, zvi, bkramer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303441 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 18:20:44 +00:00
Zachary Turner
435c118e77 [lit] Take the last error when executing pipelines.
This seems to have been present since the beginning of time,
which is quite surprising.  The symptom was this: Suppose you
have a test with a run line that looks like this:

  RUN: foo | FileCheck %s

foo prints some output and then due to a bug in the program it
asserts.  On Windows this results in the program returning a
negative exit code.  But if enough output had been printed
already by the tool so that the FileCheck match would succeed
then FileCheck would return 0, and because of bad logic in
lit this 0 return value would overwrite the failed return
value from previous items in the pipeline.  This only happened
with negative exit codes.

The most sensible behavior is to just take whatever the first
exit code is.  There is no logical ordering defined on exit
codes, so comparing with < and > does not make a lot of sense.
Instead, as soon as we find the first non-successful return
value, that should be the result of the entire expression.

This fixes the issue, as now tests which fail on non-Windows
platforms also fail for me on Windows as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303440 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 18:12:07 +00:00
Anna Thomas
54d0694b5b [NFC][loopIdiom] Clang format change rL303434
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303439 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 18:00:30 +00:00
Adrian Prantl
469e92814e ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator.
rdar://problem/31233625

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303438 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 17:55:02 +00:00
Adrian Prantl
3770b2b848 Rewrite llvm-lto's codegen() using ThinCodeGenerator::run(). NFC-ish.
Differential Revision: https://reviews.llvm.org/D33360

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303437 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 17:54:58 +00:00
Matthias Braun
556dc39f39 Fix typo in test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303436 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 17:25:20 +00:00
Simon Pilgrim
8b927bbc59 [X86][FMA] Tests showing missed fmsubadd opportunities (PR30633)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303435 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 17:19:26 +00:00
Anna Thomas
3ecd7e5faa [LoopIdiom] Refactor return value of isLegalStore [NFC]
Summary:

This NFC simply refactors the return value of LoopIdiomRecognize::isLegalStore() from bool to an enumeration, and
removes the return-through-parameter mechanism that the function was using. This function is constructed such that it will
only ever recognize a single store idiom (memset, memset_pattern, or memcpy), and never a combination of these. As such it
makes much more sense for the return value to be the single idiom that the store matches, rather than
having a separate argument-return for each idiom -- it's cleaner, and makes it clearer that
only a single idiom can be matched.

Patch by Daniel Neilson!

Reviewers: anna, sanjoy, davide, haicheng

Reviewed By: anna, haicheng

Subscribers: haicheng, mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303434 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 17:05:36 +00:00
Craig Topper
e7d6bb2063 [InstSimplify] Fix 80 column violation. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303433 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 16:56:53 +00:00
Craig Topper
47c969db7e [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
2017-05-19 16:43:54 +00:00
Dmitry Preobrazhensky
519ca37023 [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
2017-05-19 14:27:52 +00:00
Artur Pilipenko
285ad946f7 [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
2017-05-19 14:02:46 +00:00
Artur Pilipenko
481df100e8 [LoopPredication] NFC. Extract LoopPredication::expandCheck helper
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303426 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 14:00:58 +00:00
Artur Pilipenko
f7a732400a [LoopPredication] NFC. Extract CanExpand helper lambda
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303425 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 14:00:04 +00:00
Artur Pilipenko
92e33060a2 [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
2017-05-19 13:59:34 +00:00
Dmitry Preobrazhensky
ede5ffa4d3 [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
2017-05-19 13:36:09 +00:00
Guy Blank
95bb5cd8a2 [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
2017-05-19 12:35:15 +00:00
Daniel Sanders
e4e1c32fd7 [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
2017-05-19 11:08:33 +00:00
Amara Emerson
fc4cf8d86e 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
2017-05-19 10:40:18 +00:00
Volkan Keles
f7b3312470 [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
2017-05-19 09:47:02 +00:00
Craig Topper
e1b5c7ac77 [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
2017-05-19 07:37:25 +00:00
Zachary Turner
a269f90b32 Fix compilation failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303410 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 06:25:09 +00:00
Zachary Turner
27f68cfeaf 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
2017-05-19 05:57:45 +00:00
Zachary Turner
95239b531c 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
2017-05-19 05:18:09 +00:00
Zachary Turner
ac2e785519 [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
2017-05-19 04:56:48 +00:00
Davide Italiano
bd8c7210cd [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
2017-05-19 04:06:10 +00:00
Zachary Turner
4f44e8f746 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
2017-05-19 03:04:08 +00:00
Adam Nemet
586584b84a 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
2017-05-19 02:56:37 +00:00
Zachary Turner
943db67405 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
2017-05-19 00:56:39 +00:00
Matthias Braun
c6f33b7e68 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
2017-05-19 00:18:03 +00:00
Matthias Braun
e5313997b5 Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303395 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 00:17:59 +00:00
Zachary Turner
9bfe6978d3 Fix another warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303394 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-18 23:30:51 +00:00
Davide Italiano
ed2b8bd9f4 [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
2017-05-18 23:22:44 +00:00
Zachary Turner
bde49e3081 Fix some build errors and warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303391 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-18 23:12:42 +00:00
Zachary Turner
e24978b754 [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
2017-05-18 23:04:08 +00:00
Zachary Turner
47b13b0b78 [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
2017-05-18 23:03:41 +00:00
Zachary Turner
2a4f1171a7 [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
2017-05-18 23:03:06 +00:00
Sanjay Patel
7905731e09 [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
2017-05-18 22:47:57 +00:00
Davide Italiano
32baeeab7f [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
2017-05-18 21:43:23 +00:00
Eugene Zelenko
d687f9863a [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
2017-05-18 21:27:11 +00:00
Sanjay Patel
8767cef222 [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
2017-05-18 20:53:16 +00:00
Craig Topper
0c3c8c6175 [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
2017-05-18 20:27:32 +00:00
Rui Ueyama
54d256ca56 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
2017-05-18 20:18:24 +00:00
Galina Kistanova
f73a055bca LLVM_FALLTHROUGH instead of fall-through comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303375 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-18 20:01:52 +00:00
Hans Wennborg
aade6b806c 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
2017-05-18 18:50:05 +00:00