Commit Graph

149427 Commits

Author SHA1 Message Date
David Blaikie
7bfd7c00d7 Fix -Wunneeded-internal-declaration by removing constant arrays only used in sizeof expressions, in favor of constants containing the size directly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303483 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 03:32:51 +00:00
David Blaikie
0025fa12f8 llvm-symbolizer: Support multiple CUs in a single DWO file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303482 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 03:32:49 +00:00
Eric Beckmann
836dd8e1f0 Add functionality to cvtres to parse all entries in res file.
Summary: Added the new modules in the Object/ folder.  Updated the
llvm-cvtres interface as well, and added additional tests.

Subscribers: llvm-commits, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303480 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 01:49:19 +00:00
Matthias Braun
e60d79f9d7 Fix breakage after r303461
- Improve wchar_t size predicitions based on target triple.
- Be less strict in wchar_t size verifier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303477 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 01:28:52 +00:00
Davide Italiano
204f8c0a24 [NewGVN] Create a StoreExpression instead of a VariableExpression.
In the case where we have an operand defined by a lod of the
same memory location. Historically this was a VariableExpression
because we wanted to make sure they ended up in the same class,
but if we create the right expression, they end up in the same
class anyway.

Fixes PR32897. Thanks to Dan for the detailed discussion and the
fix suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303475 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 00:46:54 +00:00
Davide Italiano
2d9c8197c8 [NewGVN] Get rid of an assertion.
This was here because we don't want to switch leaders too much,
in order to avoid fixpoint(ing) issue, but it's not sure if it
matters in practice.

A first step towards fixing PR32897.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303473 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 00:24:04 +00:00
Galina Kistanova
971abf1576 Cosmetic. Added braces to address gcc warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303471 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 00:02:08 +00:00
Adrian Prantl
82673ec6c6 Revert "Revert "ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator.""
This reapplies commit r303438 modified to not verify cross-imported
bitcode in FunctionImporter.

rdar://problem/31233625

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303470 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 00:00:08 +00:00
Adrian Prantl
b4067a0833 Revert "ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator."
This reverts commit r303438 while deliberating buildbot breakage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303467 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 23:32:21 +00:00
Matthias Braun
708626d601 SimplifyLibCalls: Optimize wcslen
Refactor the strlen optimization code to work for both strlen and wcslen.

This especially helps with programs in the wild where people pass
L"string"s to const std::wstring& function parameters and the wstring
constructor gets inlined.

This also fixes a lingerind API problem/bug in getConstantStringInfo()
where zeroinitializers would always give you an empty string (without a
length) back regardless of the actual length of the initializer which
did not work well in the TrimAtNul==false causing the PR mentioned
below.

Note that the fixed getConstantStringInfo() needed fixes to SelectionDAG
memcpy lowering and may lead to some cases for out-of-bounds
zeroinitializer accesses not getting optimized anymore. So some code
with UB may produce out of bound memory reads now instead of just
producing zeros.

The refactoring "accidentally" fixes http://llvm.org/PR32124

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303461 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 22:37:09 +00:00
Matthias Braun
60ecb7fde8 Verifier: Check wchar_size module flag.
Differential Revision: https://reviews.llvm.org/D32974

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303460 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 22:37:01 +00:00
Reid Kleckner
e6f2078382 Fix off-by-one bug in AttributeList::addAttributes index handling
getParamAlignment expects an argument number, not an AttributeList
index.

Johan Englan, who works on LDC, found this bug and told me about it off
list.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303458 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 22:23:47 +00:00
Galina Kistanova
e5180ba874 Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303457 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 21:08:28 +00:00
Evgeniy Stepanov
794ffc40e2 [safestack] Disable stack coloring by default.
Workaround for apparent miscompilation of PR32143.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303456 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 20:58:48 +00:00
Galina Kistanova
fc18e2f236 Added missing break.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303454 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 20:31:51 +00:00
Daniel Berlin
55d8857f8f NewGVN: Fix PR32838.
This is a complicated bug involving two issues:
1. What do we do with phi nodes when we prove all arguments are not
live?
2. When is it safe to use value leaders to determine if we can ignore
an argumnet?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303453 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 20:22:20 +00:00
Daniel Berlin
d17a1f5921 NewGVN: Print out the StoredValue of a StoreExpression
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303452 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 20:22:14 +00:00
Simon Pilgrim
46742151c4 Fix line-endings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303448 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 19:47:29 +00:00
Davide Italiano
ef0829e2df [InstCombine] *Actually* commit the test showing the miscompile.
Clarify a comment while I'm here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303447 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 19:41:11 +00:00
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