Commit Graph

149387 Commits

Author SHA1 Message Date
Sanjoy Das
9870934154 Revert "[SCEV] Clarify behavior around max backedge taken count"
This reverts commit r303497 since it breaks the msan bootstrap bot:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/1379/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303498 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 05:02:12 +00:00
Sanjoy Das
67c14497b1 [SCEV] Clarify behavior around max backedge taken count
This change makes the split between the "exact" backedge taken count
and the "maximum" backedge taken count a bit more obvious.  Both of
these are upper bounds on the number of times the loop header
executes (since SCEV does not account for most kinds of abnormal
control flow), but the latter is guaranteed to be a constant.

There were a few places where the max backedge taken count *was* a
non-constant; I've changed those to compute constants instead.

At this point, I'm not sure if the constant max backedge count can be
computed by calling `getUnsignedRange(Exact).getUnsignedMax()` without
losing precision.  If it can, we can simplify even further by making
`getMaxBackedgeTakenCount` a thin wrapper around
`getBackedgeTakenCount` and `getUnsignedRange`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303497 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 01:47:50 +00:00
Xin Tong
a9ee0160e6 Revert "Add pthread_self function prototype and make it speculatable."
This reverts commit 143d7445b5.

Build breaking

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303496 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 00:37:55 +00:00
Xin Tong
143d7445b5 Add pthread_self function prototype and make it speculatable.
Summary: This allows pthread_self to be pulled out of a loop by LICM.

Reviewers: hfinkel, arsenm, davide

Reviewed By: davide

Subscribers: davide, wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303495 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 22:40:25 +00:00
Martell Malone
445f6b560d COFF: Fix another StringRef return error
This should appease the lld build bot regression
Following up on rL303493

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303494 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 21:54:15 +00:00
Martell Malone
69f0d8825b COFF: Fix single StringRef return error
This should appease the lld build bot regression
Intrroduced by rL303490

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303493 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 21:00:36 +00:00
Martell Malone
ec718cbf10 COFF: migrate def parser from LLD to LLVM [1/2]
This is split up into two commits.
The will create the DEF parser in LLVM.
Check the following commit to see the removal from LLD

Reviewers: ruiu

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303490 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 19:56:29 +00:00
Xin Tong
fcebfdfa41 Fix test typo. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303489 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 19:40:24 +00:00
Duncan P. N. Exon Smith
40549e6094 Docs: Fix pluralization in CMake docs
Fixed "most platform" to read "most platforms", and changed "are not
using the same" to "use different" as a drive-by.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303487 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 05:25:19 +00:00
George Burgess IV
fb8d01efbe [docs] Small style nits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303486 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 04:52:29 +00:00
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