Commit Graph

149410 Commits

Author SHA1 Message Date
Strahinja Petrovic
3c94f1d059 [MIPS] Add support to match more patterns for DINS instruction
This patch adds support for recognizing patterns to match
DINS instruction.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303537 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 09:06:44 +00:00
James Molloy
7ff1c268d6 Revert "[ARM] Clear the constant pool cache on explicit .ltorg directives"
This reverts commit r302416. This was a fixup for r286006, which has now been reverted so this doesn't apply (either in concept or in code).

This commit itself has no problems, but the underlying issue it was fixing has now disappeared from the codebase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303536 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 08:49:28 +00:00
James Molloy
9d3d965348 Revert "Fix 24560: assembler does not share constant pool for same constants"
This reverts commit r286006. It caused PR32825 and wasn't fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303535 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 08:42:47 +00:00
Amaury Sechet
405d07a3a6 Regenerate expected result for test constant-combines.ll . NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303533 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 07:49:16 +00:00
David Blaikie
9031fd9199 libDebugInfo/DWARF: Apply relocations for debug_addr addresses in object files
llvm-symbolizer would fail to symbolize addresses in unlinked object
files when handling .dwo file data because the addresses would not be
relocated in the same way as the ranges in the skeleton CU in the object
file.

Fix that so object files can be symbolized the same as executables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303532 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 07:02:47 +00:00
Sanjoy Das
c83e065234 [SCEV] Clarify behavior around max backedge taken count
This is a re-application of a r303497 that was reverted in r303498.
I thought it had broken a bot when it had not (the breakage did not
go away with the revert).

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@303531 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 06:46:04 +00:00
Zvi Rackover
c13111a6fd [X86] Add (ix bitcast(vsetcc)) test cases with illegal types. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303530 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 06:39:12 +00:00
Craig Topper
80b8691318 [InstCombine] Cleanup the interface for overflow checks
Summary:
Fix naming conventions and const correctness.
This completes the changes made in rL303029.

Patch by Yoav Ben-Shalom.

Reviewers: craig.topper

Reviewed By: craig.topper

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303529 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 06:25:31 +00:00
Amaury Sechet
ba7c7e397f Add a test case for large integer subtraction via subcarry. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303528 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 06:06:45 +00:00
Amaury Sechet
7184d2e1ad Add test case for subcarry optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303525 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 02:31:42 +00:00
Craig Topper
63270bdd55 [SimplifyCFG] Prevent a few APInt copies on method calls that return const reference. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303523 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 00:49:35 +00:00
Craig Topper
eb118f2981 [KnownBits] Use isNegative/isNonNegative to shorten some code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303522 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-22 00:49:33 +00:00
Daniel Berlin
cc24c88dcf NewGVN: Fix PR 33116, the memoryphi version of bug 32838.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303521 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 23:41:58 +00:00
Daniel Berlin
06366afa19 NewGVN: Cleanup some repeated code using some templated helpers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303520 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 23:41:56 +00:00
Daniel Berlin
efa684722e NewGVN: Fix printing of simplified expression
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303519 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 23:41:53 +00:00
Daniel Berlin
5dcdd10cbc SmallPtrSetImpl/SmallPtrSet: Add a public value_type and key_type
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303518 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 23:41:51 +00:00
Davide Italiano
5d18059ccf [NewGVN] Actually check the NewGVN output.
Apparently I messed up squashing two consecutive commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303516 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 20:55:53 +00:00
Davide Italiano
96cb8145e1 [NewGVN] Add a test for non most dominating leader.
Taken from PR32845. Dan removed the most dominating leader check
in r303443, but we check this test anyway to make sure things
don't regress.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303515 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 20:50:16 +00:00
Davide Italiano
4276950084 [InstCombine] Take in account the size in sext->lshr->trunc patterns.
Otherwise we end up miscompiling, transforming:

define i8 @tinky() {
  %sext = sext i1 1 to i16
  %hibit = lshr i16 %sext, 15
  %tr = trunc i16 %hibit to i8
  ret i8 %tr
}

into:

  %sext = sext i1 1 to i8
  ret i8 %sext

and the first get folded to ret i8 1, while the second gets folded
to ret i8 -1.

Eventually we should get rid of this transform entirely, but for now,
this at least fixes a know correctness bug.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303513 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 20:30:27 +00:00
Sanjay Patel
68ac6769cc [InstCombine] add tests for potential (lshr(sext X), C) folds; NFC
As discussed in:
https://reviews.llvm.org/D33338
...we may be able to remove a wider pattern match by doing these more
basic canonicalizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303504 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 15:18:52 +00:00
Igor Breger
a3d2650741 [GlobalISel][X86] Fix G_TRUNC instruction selection.
Updated tests with -verify-machineinstrs flag.
It fixes 3 tests failed with machine verifier enabled and listed
in PR27481

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303502 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 11:13:56 +00:00
Hiroshi Inoue
4d0494d621 Summary
PPC backend eliminates compare instructions by using record-form instructions in PPCInstrInfo::optimizeCompareInstr, which is called from peephole optimization pass.
This patch improves this optimization to eliminate more compare instructions in two types of common case.


- comparison against a constant 1 or -1

The record-form instructions set CR bit based on signed comparison against 0. So, the current implementation does not exploit the record-form instruction for comparison against a non-zero constant.
This patch enables record-form optimization for constant of 1 or -1 if possible; it changes the condition "greater than -1" into "greater than or equal to 0" and "less than 1" into "less than or equal to 0".
With this patch, compare can be eliminated in the following code sequence, as an example.

uint64_t a, b;
if ((a | b) & 0x8000000000000000ull) { ... }
else { ... }


- andi for 32-bit comparison on PPC64

Since record-form instructions execute 64-bit signed comparison and so we have limitation in eliminating 32-bit comparison, i.e. with cmplwi, using the record-form. The original implementation already has such checks but andi. is not recognized as an instruction which executes implicit zero extension and hence safe to convert into record-form if used for equality check.

%1 = and i32 %a, 10
%2 = icmp ne i32 %1, 0
br i1 %2, label %foo, label %bar

In this simple example, LLVM generates andi. + cmplwi + beq on PPC64.
This patch make it possible to eliminate the cmplwi for this case.
I added andi. for optimization targets if it is safe to do so.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303500 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 06:00:05 +00:00
George Burgess IV
cd631cca05 [Docs] Fix LangRef links referred in GetElementPtr.rst
Patch by chenwj!

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303499 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 05:31:29 +00:00
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