OSDN Git Service

android-x86/external-llvm.git
7 years ago[NewGVN] Create a StoreExpression instead of a VariableExpression.
Davide Italiano [Sat, 20 May 2017 00:46:54 +0000 (00:46 +0000)]
[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

7 years ago[NewGVN] Get rid of an assertion.
Davide Italiano [Sat, 20 May 2017 00:24:04 +0000 (00:24 +0000)]
[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

7 years agoCosmetic. Added braces to address gcc warning: suggest explicit braces to avoid ambig...
Galina Kistanova [Sat, 20 May 2017 00:02:08 +0000 (00:02 +0000)]
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

7 years agoRevert "Revert "ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator.""
Adrian Prantl [Sat, 20 May 2017 00:00:08 +0000 (00:00 +0000)]
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

7 years agoRevert "ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator."
Adrian Prantl [Fri, 19 May 2017 23:32:21 +0000 (23:32 +0000)]
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

7 years agoSimplifyLibCalls: Optimize wcslen
Matthias Braun [Fri, 19 May 2017 22:37:09 +0000 (22:37 +0000)]
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

7 years agoVerifier: Check wchar_size module flag.
Matthias Braun [Fri, 19 May 2017 22:37:01 +0000 (22:37 +0000)]
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

7 years agoFix off-by-one bug in AttributeList::addAttributes index handling
Reid Kleckner [Fri, 19 May 2017 22:23:47 +0000 (22:23 +0000)]
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

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Fri, 19 May 2017 21:08:28 +0000 (21:08 +0000)]
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

7 years ago[safestack] Disable stack coloring by default.
Evgeniy Stepanov [Fri, 19 May 2017 20:58:48 +0000 (20:58 +0000)]
[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

7 years agoAdded missing break.
Galina Kistanova [Fri, 19 May 2017 20:31:51 +0000 (20:31 +0000)]
Added missing break.

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

7 years agoNewGVN: Fix PR32838.
Daniel Berlin [Fri, 19 May 2017 20:22:20 +0000 (20:22 +0000)]
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

7 years agoNewGVN: Print out the StoredValue of a StoreExpression
Daniel Berlin [Fri, 19 May 2017 20:22:14 +0000 (20:22 +0000)]
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

7 years agoFix line-endings.
Simon Pilgrim [Fri, 19 May 2017 19:47:29 +0000 (19:47 +0000)]
Fix line-endings.

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

7 years ago[InstCombine] *Actually* commit the test showing the miscompile.
Davide Italiano [Fri, 19 May 2017 19:41:11 +0000 (19:41 +0000)]
[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

7 years agoResubmit "[CodeView] Provide a common interface for type collections."
Zachary Turner [Fri, 19 May 2017 19:26:58 +0000 (19:26 +0000)]
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

7 years ago[InstCombine] Add tests to demonstrate the miscompile in PR33078.
Davide Italiano [Fri, 19 May 2017 19:23:24 +0000 (19:23 +0000)]
[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

7 years agoLast of the major pieces to NewGVN - yay!
Daniel Berlin [Fri, 19 May 2017 19:01:27 +0000 (19:01 +0000)]
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

7 years agoNewGVN: Get rid of most dominating leader check
Daniel Berlin [Fri, 19 May 2017 19:01:24 +0000 (19:01 +0000)]
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

7 years agoBasicAA: Uninserted instructions have no parent, and notDifferentParent explicitly...
Daniel Berlin [Fri, 19 May 2017 19:01:21 +0000 (19:01 +0000)]
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

7 years ago[DAGCombine] (addcarry 0, 0, X) -> (ext/trunc X)
Amaury Sechet [Fri, 19 May 2017 18:20:44 +0000 (18:20 +0000)]
[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

7 years ago[lit] Take the last error when executing pipelines.
Zachary Turner [Fri, 19 May 2017 18:12:07 +0000 (18:12 +0000)]
[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

7 years ago[NFC][loopIdiom] Clang format change rL303434
Anna Thomas [Fri, 19 May 2017 18:00:30 +0000 (18:00 +0000)]
[NFC][loopIdiom] Clang format change rL303434

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

7 years agoThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator.
Adrian Prantl [Fri, 19 May 2017 17:55:02 +0000 (17:55 +0000)]
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

7 years agoRewrite llvm-lto's codegen() using ThinCodeGenerator::run(). NFC-ish.
Adrian Prantl [Fri, 19 May 2017 17:54:58 +0000 (17:54 +0000)]
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

7 years agoFix typo in test
Matthias Braun [Fri, 19 May 2017 17:25:20 +0000 (17:25 +0000)]
Fix typo in test

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

7 years ago[X86][FMA] Tests showing missed fmsubadd opportunities (PR30633)
Simon Pilgrim [Fri, 19 May 2017 17:19:26 +0000 (17:19 +0000)]
[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

7 years ago[LoopIdiom] Refactor return value of isLegalStore [NFC]
Anna Thomas [Fri, 19 May 2017 17:05:36 +0000 (17:05 +0000)]
[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

7 years ago[InstSimplify] Fix 80 column violation. NFC
Craig Topper [Fri, 19 May 2017 16:56:53 +0000 (16:56 +0000)]
[InstSimplify] Fix 80 column violation. NFC

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

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