Commit Graph

91031 Commits

Author SHA1 Message Date
Matt Arsenault
14cb586d5e AMDGPU: Add fract intrinsic
Remove broken patterns matching it. This was matching the
unsafe math pattern and expanding the fix for the buggy instruction
from the pattern. The problems are also on CI. Remove the workarounds
and only use fract with unsafe math or from the intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271078 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-28 00:19:52 +00:00
Evgeny Stupachenko
6be2be5352 The patch fixes r271071
Summary:
unused variables in Release mode:
  BasicBlock *Header
  unsigned OrigCount
put under DEBUG

From: Evgeny Stupachenko <evstupac@gmail.com>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271076 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-28 00:14:58 +00:00
Xinliang David Li
bc6df7a799 [PM] Port the Sample FDO to new PM (part-2)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271072 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 23:20:16 +00:00
Evgeny Stupachenko
1369b53da1 The patch refactors unroll pass.
Summary:
Unroll factor (Count) calculations moved to a new function.
Early exits on pragma and "-unroll-count" defined factor added.
New type of unrolling "Force" introduced (previously used implicitly).
New unroll preference "AllowRemainder" introduced and set "true" by default.
(should be set to false for architectures that suffers from it).

Reviewers: hfinkel, mzolotukhin, zzheng

Differential Revision: http://reviews.llvm.org/D19553

From: Evgeny Stupachenko <evstupac@gmail.com>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271071 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 23:15:06 +00:00
Sanjoy Das
051a0b5646 Use C++ casts to avoid a warning
warning: cast from type ‘const void*’ to type
‘llvm::PrettyStackTraceEntry*’ casts away qualifiers [-Wcast-qual]
   PrettyStackTraceHead = (PrettyStackTraceEntry*)Top;

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271069 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 23:04:28 +00:00
Andrew Kaylor
c465f6c040 Update the stack coloring pass to remove lifetime intrinsics in the optnone/opt-bisect skip case.
Differential Revision: http://reviews.llvm.org/D20453



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271068 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 22:56:49 +00:00
Vitaly Buka
5683aa8247 [asan] Add option to enable asan-use-after-scope from clang.
Clang will have -fsanitize-address-use-after-scope flag.

PR27453

Reviewers: kcc, eugenis, aizatsky

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D20750

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271067 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 22:55:10 +00:00
Rafael Espindola
3d3b6e3e28 Start using shouldAssumeDSOLocal on ARM.
Given where this is used it should be a nop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271066 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 22:41:51 +00:00
Xinliang David Li
329be24262 [PM] Port the Sample FDO to new PM (part-1)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271062 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 22:30:44 +00:00
Matthias Braun
a827bf1ce5 MachineScheduler: Introduce ONLY1 reason to improve debug output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271058 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 22:14:26 +00:00
Matthias Braun
da265fc2fa AArch64Subtarget: Use default member initializers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271057 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 22:14:09 +00:00
David Majnemer
b2f9f8e5dd Don't discard errors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271056 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 22:07:50 +00:00
Kostya Serebryany
dc4065fcc1 [libFuzzer] use __sanitizer_set_report_fd with -close_fd_mask. This allows us to keep asan reports when closing target's stderr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271053 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 21:46:22 +00:00
Rafael Espindola
a31d45bb57 Map DynamicNoPIC to Static on non-darwin.
DynamicNoPIC was only every used on darwin. This maps it to static on
ELF. It matches what is done on X86.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271052 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 21:44:18 +00:00
Sanjay Patel
1d110c83c2 [InstCombine] move and/sext fold to helper function; NFCI
We need to enhance the pattern matching on these to look through bitcasts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271051 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 21:41:29 +00:00
Krzysztof Parzyszek
c1712d6440 [Hexagon] Use standard macros to initialize HexagonExpandCondsets pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271045 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 21:15:34 +00:00
Richard Smith
0513d1e203 Fix compilation with GCC, which treats this as a constructor name not a type
name. (GCC is correct here per the latest language DRs.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271044 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 21:05:35 +00:00
Krzysztof Parzyszek
8e211bbca8 [Hexagon] Do not create passes in the constructor of HexagonPassConfig
When running mir tests, a pass created in that constructor would not be
freed, leading to memory leaks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271043 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 20:48:39 +00:00
Davide Italiano
cd543d7ad6 [LCSSA] Simplify. Suggested by Sanjoy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271041 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 20:25:31 +00:00
Zachary Turner
fb799608d4 [pdb] Fix size check when reading stream bytes.
We were accidentally bounds checking the read against the output
ArrayRef instead of against the size of the read.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271040 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 20:17:33 +00:00
Petr Hosek
6cc1a144bd Revert "[MC] Support symbolic expressions in assembly directives"
This reverts commit r271028, it causes the directive_fill.s to fail.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271038 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 19:58:05 +00:00
Sanjoy Das
52443d6b0b [GVN] Preserve !range metadata when PRE'ing loads
Reviewers: dberlin, reames, george.burgess.iv

Subscribers: mcrosier, llvm-commits

Differential Revision: http://reviews.llvm.org/D20743

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271034 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 19:03:10 +00:00
Michael Kuperstein
780aab5bdb [X86] Detect SAD patterns and emit psadbw instructions.
This recommits r267649 with a fix for PR27539.

Differential Revision: http://reviews.llvm.org/D20598


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271033 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 18:53:22 +00:00
David Majnemer
c21577e202 Make sure data is available before dereferencing it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271032 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 18:50:02 +00:00
Petr Hosek
1ae94e2387 [MC] Support symbolic expressions in assembly directives
This matches the behavior of GNU assembler which supports symbolic
expressions in absolute expressions used in assembly directives.

Differential Revision: http://reviews.llvm.org/D20656

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271028 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 18:49:44 +00:00
Zachary Turner
e8799b644b Resubmit "[pdb] Allow zero-copy read support for symbol streams.""
Due to differences in template instantiation rules, it is not
portable to static_assert(false) inside of an invalid specialization
of a template.  Instead I just =delete the method so that it can't
be used, and leave a comment that it must be explicitly specialized.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271027 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 18:47:20 +00:00
Chad Rosier
1f37794220 Revert "[pdb] Allow zero-copy read support for symbol streams."
This reverts commit r271024 due to error: static_assert failed
"You must either provide a specialization of VarStreamArrayExtractor
or a custom extractor"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271026 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 18:31:02 +00:00
Zachary Turner
6e1b1bf7c7 [pdb] Allow zero-copy read support for symbol streams.
This reduces the amount of memory used by llvm-pdbdump by roughly
1/3 of the size of the PDB file.

Differential Revision: http://reviews.llvm.org/D20724
Reviewed By: ruiu

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271025 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 18:20:20 +00:00
Ahmed Bougacha
8360163913 [X86] Clarify PSHUFB+blend lowering function name. NFC.
Also guard against v32i8 users.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271024 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 17:58:17 +00:00
Ahmed Bougacha
9629952ed7 [ARM] Remove tBLXr Pat made redundant by r269101. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271023 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 17:58:03 +00:00
Benjamin Kramer
c4a6700e58 [ProfData] Remove global constructor from ProfileSummaryBuilder.
No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271021 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 17:38:16 +00:00
Pete Cooper
90a2421c29 Don't generate unnecessary signed ConstantRange during multiply. NFC
r231483 taught ConstantRange::multiply to be clever about signed vs unsigned ranges. For example, an unsigned range could be full-set while the signed range is more specific than that.

In looking at the allocations trace for LTO'ing verify-uselistorder (see r236629 for details), millions of allocations are from APInt, many of which come from ConstantRange's.

This change tries to avoid some (3.2 million) allocations by returning the unsigned range if its suitable. The checks here are that it should not be a wrapping range, and should be positive. That should be enough to check for ranges such as [1, 10) which the signed range will be equal to, if we were to calculate it.

Differential Revision: http://reviews.llvm.org/D20723

Reviewed by James Molloy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271020 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 17:06:50 +00:00
Benjamin Kramer
4964a7bd67 Use StringRef::startswith instead of find(...) == 0.
It's faster and easier to read.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271018 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 16:54:57 +00:00
Benjamin Kramer
d8b9eeef20 [sparc] Simplify a slow and verbose way of checking if a string starts with "ld".
PR27904.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271016 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 16:45:37 +00:00
Tim Northover
e1ebc76f2d Vectorizer: track non-fast FP instructions through phis when finding reductions.
When we traced through a phi node looking for floating-point reductions, we
forgot whether we'd ever seen an instruction without fast-math flags (that
would block vectorization). This propagates it through to the end.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271015 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 16:40:27 +00:00
Xinliang David Li
12ee1c1512 Reapply r270865 -- previous bot failure is unrelated
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271014 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 16:22:03 +00:00
David Majnemer
d92a2587d3 Make sure these error codes are marked as checked
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271013 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 16:16:56 +00:00
David Majnemer
c41579b54a Make sure there are enough blocks for the stream
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271012 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 16:16:48 +00:00
David Majnemer
6768e77696 Make sure the directory block array fits in the file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271011 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 16:16:45 +00:00
Dehao Chen
f11d66d7cf Remove sample profile dependency to instcombine, which is not a analysis pass.
Summary: This patch removes dependency from sample profile pass to instcombine pass.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D20501

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271009 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 16:14:15 +00:00
David Majnemer
36fbd0404a Validate the blocksize before using it
The blocksize could be zero on disk causing later checks to divide by
zero.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271008 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 15:57:38 +00:00
Than McIntosh
019fdc9db3 Disable lifetime-start-on-first-use analysis.
Summary:
Turn off lifetime-start-on-first-use enhancement for the moment
pending a fix for bug 27903.

Bug: 27903

Reviewers: tejohnson, wmi, qcolombet, gbiv

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D20731

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271003 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 15:27:51 +00:00
Benjamin Kramer
14aae01bc3 Apply clang-tidy's misc-move-constructor-init throughout LLVM.
No functionality change intended, maybe a tiny performance improvement.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270997 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 14:27:24 +00:00
Simon Dardis
bba655e896 [mips] Weaken asm predicate for memory offsets
The isMemWithSimmOffset predicate rejects relocations which is incorrect
behaviour. Linkers and other tools should handle|warn|error when the
field overflows.

Reviewers: dsanders, vkalintiris

Differential Revision: http://reviews.llvm.org/D20727



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270995 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 13:56:36 +00:00
Igor Laevsky
ceb0f307b3 [RewriteStatepointsForGC] All constant should have null base pointer
Currently we consider that each constant has itself as a base value. I.e "base(const) = const". 
This introduces couple of problems when we are trying to avoid reporting constants in statepoint live sets:

1. When querying "base( phi(const1, const2) )" we will get "phi(const1, const2)" as a base pointer. Since 
   it's not a constant we will record it in a stack map. However on practice we don't want this to happen
   (constant are never relocated).
2. base( phi(const, gc ptr) ) = phi( const, base(gc ptr) ). This particular case imposes challenge on our 
   runtime - we don't expect to see constant base pointers other than null. This problems can be avoided 
   by treating all constant as if they were derived from null pointer base. I.e in a first case we will 
   not include constant pointer in a stack map at all. In a second case we will get "phi(null, base(gc ptr))" 
   as a base pointer which is a lot more convenient.

Differential Revision: http://reviews.llvm.org/D20584



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270993 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 13:13:59 +00:00
Artem Tamazov
87370fd0bc [AMDGPU][llvm-mc] Square-braced-syntax for registers - make ":expr2" optional.
Register numbers may be specified as assembly-time expressions.
This feature can be useful in macros and alike. However, expressions
are supported within sqare braces only.

Sqare braces were initially intended to support specifying of multiple
(pairs/quads...) registers. Syntax like v[8:8] which specifies single register
is also supported. That allows expressions but looks a bit unnatural.

This change supports syntax REG[EXPR].
Tests added.

Differential Revision: http://reviews.llvm.org/D20588

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270990 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 12:50:13 +00:00
Benjamin Kramer
b397ac432d Avoid some copies by using const references.
clang-tidy's performance-unnecessary-copy-initialization with some manual
fixes. No functional changes intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270988 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 12:30:51 +00:00
George Rimar
ec285af61c Recommit 270977 - [llvm-mc] - Teach llvm-mc to generate zlib styled compression sections.
Fix: updated clang code which was not updated by mistake.

Original commit message:
[llvm-mc] - Teach llvm-mc to generate zlib styled compression sections.

This patch is strongly based on previously reverted D20331.
(because of gnuutils < 2.26 does not support compressed debug sections in non zlib-gnu style)

Difference that this patch supports both zlib and zlib-gnu styles.

-compress-debug-sections option now supports next values:

-compress-debug-sections=zlib-gnu
-compress-debug-sections=zlib
-compress-debug-sections=none
Previously specifying -compress-debug-sections enabled zlib-gnu compression,
so anyone can put "-compress-debug-sections=zlib-gnu" to restore the behavior
that was before this patch for case when compression was enabled.

Differential revision: http://reviews.llvm.org/D20676

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270987 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 12:27:32 +00:00
Benjamin Kramer
0ad6107994 Apply clang-tidy's misc-static-assert where it makes sense.
Also fold conditions into assert(0) where it makes sense. No functional
change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270982 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 11:36:04 +00:00
Benjamin Kramer
37ac5263bc [sparc] Remove some unused (and undefined) declarations.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270981 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 10:19:03 +00:00
Benjamin Kramer
e1a12fcbf1 [hexagon] Move BlockRanges and RDF stuff into the llvm namespace.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270980 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 10:06:40 +00:00
Benjamin Kramer
14848ded98 [sparc] Move LEON passes into llvm namespace.
Also give them library visiblity while there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270979 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 10:06:27 +00:00
George Rimar
8ab5c74bc0 Revert r270977 ([llvm-mc] - Teach llvm-mc to generate zlib styled compression sections.)
It broke buildbot:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/13585/steps/build/logs/stdio

Initial commit message:
[llvm-mc] - Teach llvm-mc to generate zlib styled compression sections.

This patch is strongly based on previously reverted D20331.
(because of gnuutils < 2.26 does not support compressed debug sections in non zlib-gnu style)

Difference that this patch supports both zlib and zlib-gnu styles.

-compress-debug-sections option now supports next values:

-compress-debug-sections=zlib-gnu
-compress-debug-sections=zlib
-compress-debug-sections=none
Previously specifying -compress-debug-sections enabled zlib-gnu compression,
so anyone can put "-compress-debug-sections=zlib-gnu" to restore the behavior
that was before this patch for case when compression was enabled.

Differential revision: http://reviews.llvm.org/D20676

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270978 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 10:06:16 +00:00
George Rimar
dd4101a976 [llvm-mc] - Teach llvm-mc to generate zlib styled compression sections.
This patch is strongly based on previously reverted D20331.
(because of gnuutils < 2.26 does not support compressed debug sections in non zlib-gnu style)

Difference that this patch supports both zlib and zlib-gnu styles.

-compress-debug-sections option now supports next values:

-compress-debug-sections=zlib-gnu
-compress-debug-sections=zlib
-compress-debug-sections=none
Previously specifying -compress-debug-sections enabled zlib-gnu compression,
so anyone can put "-compress-debug-sections=zlib-gnu" to restore the behavior
that was before this patch for case when compression was enabled.

Differential revision: http://reviews.llvm.org/D20676

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270977 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 09:58:08 +00:00
Simon Pilgrim
3808026456 Revert: r270973 - [X86][SSE] Replace (V)PMOVSX and (V)PMOVZX integer extension intrinsics with generic IR (llvm)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270976 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 09:02:25 +00:00
Simon Pilgrim
337a02bbe0 [X86][SSE] Replace (V)PMOVSX and (V)PMOVZX integer extension intrinsics with generic IR (llvm)
This patch removes the llvm intrinsics VPMOVSX and (V)PMOVZX sign/zero extension intrinsics and auto-upgrades to SEXT/ZEXT calls instead. We already did this for SSE41 PMOVSX sometime ago so much of that implementation can be reused.

A companion patch (D20684) removes/auto-upgrade the clang intrinsics.

Differential Revision: http://reviews.llvm.org/D20686

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270973 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 08:49:15 +00:00
Peter Collingbourne
b7bfc99302 Linker: teach the IR mover to return llvm::Error.
This will be needed in order to consistently return an Error
to clients of the API being developed in D20268.

Differential Revision: http://reviews.llvm.org/D20550

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270967 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 05:21:35 +00:00
Zachary Turner
9cc0faee65 [codeview] Remove StreamReader copying method.
Since we want to move toward zero-copy access to stream data, we
want to remove all instances of copying operations.  So get rid
of some of those here.

Differential Revision: http://reviews.llvm.org/D20720
Reviewed By: ruiu

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270960 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 03:51:53 +00:00
Pete Cooper
1544fa2368 Don't allocate unnecessarily in APInt::operator[+-]. NFC.
APInt::operator+(uint64_t) just forwarded to operator+(const APInt&).

Constructing the APInt for the RHS takes an allocation which isn't
required.  Also, for APInt's in the slow path, operator+ would
call add() internally which iterates over both arrays of values.  Instead
we can use add_1 and sub_1 which only iterate while there is something to do.

Using the memory for 'opt -O2 verify-uselistorder.lto.opt.bc -o opt.bc'
(see r236629 for details), this reduces the number of allocations from
23.9M to 22.7M.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270959 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 03:42:17 +00:00
Dan Liew
70172d9997 [LibFuzzer] Refactor declaration of tests in CMake.
Add a new CMake function (``add_libfuzzer_test()``) to simplify
declaration of executables for testing LibFuzzer and use it to
reorganise how tests are declared.

Note that configuration of the lit configuration files has been moved
as late as possible because we are going to need to disable some tests
for some platforms and we will need to propagate this information into
the lit configuration.

Note the code for custom mains was removed because no tests are
currently written for this and Kostya seems happy to remove this.

Differential Revision: http://reviews.llvm.org/D20706

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270958 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 03:14:40 +00:00
Pete Cooper
47d07cc190 Form objc_storeStrong in the presence of bitcasts.
objc_storeStrong can be formed from a sequence such as

  %0 = tail call i8* @objc_retain(i8* %p) nounwind
  %tmp = load i8*, i8** @x, align 8
  store i8* %0, i8** @x, align 8
  tail call void @objc_release(i8* %tmp) nounwind

The code was already looking through bitcasts for most of the values
involved, but had missed one case where the pointer operand for the
store was a bitcast.  Ultimately the pointer for the load and store
have to be the same value, after stripping casts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270955 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 02:13:53 +00:00
Zachary Turner
0212bc82e0 [codeview,pdb] Try really hard to conserve memory when reading.
PDBs can be extremely large.  We're already mapping the entire
PDB into the process's address space, but to make matters worse
the blocks of the PDB are not arranged contiguously.  So, when
we have something like an array or a string embedded into the
stream, we have to make a copy.  Since it's convenient to use
traditional data structures to iterate and manipulate these
records, we need the memory to be contiguous.

As a result of this, we were using roughly twice as much memory
as the file size of the PDB, because every stream was copied
out and re-stitched together contiguously.

This patch addresses this by improving the MappedBlockStream
to allocate from a BumpPtrAllocator only when a read requires
a discontiguous read.  Furthermore, it introduces some data
structures backed by a stream which can iterate over both
fixed and variable length records of a PDB.  Since everything
is backed by a stream and not a buffer, we can read almost
everything from the PDB with zero copies.

Differential Revision: http://reviews.llvm.org/D20654
Reviewed By: ruiu

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270951 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 01:54:44 +00:00
Lang Hames
c93d4ea0e3 [Support] Rename unconvertibleErrorCode to inconvertibleErrorCode.
Based on a totally scientific, 30 second google search "in-" appears to be the
preferred prefix.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270950 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 01:54:25 +00:00
Lang Hames
5083fc5573 [Support] Add a StringError convenience class to Error.h
StringError can be used to represent Errors that aren't recoverable based on
the error type, but that have a useful error message that can be reported to
the user or logged.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270948 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 01:37:32 +00:00
Kostya Serebryany
3e20a7ae17 [libFuzzer] make check-fuzzer a bit faster
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270947 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 01:12:21 +00:00
Michael Zolotukhin
317420aa78 [LoopUnrollAnalyzer] Bail out instead of dying with assert when facing huge index.
This fixes PR27902.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270946 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 00:55:16 +00:00
Kostya Serebryany
6effb7148b [libFuzzer] make OOM-handling more portable. Instead of sending a signal to the main fuzzing thread, print the message in the getrusage thread and exit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270945 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 00:54:15 +00:00
Mehdi Amini
1334ad39b1 ValueMapper: fix typo in minor optimization on constant mapping (NFC)
If every operands of a constant are mapping to themselves, and the
type does not change, we have an early exit as acknowledged in the
comment:

  // Otherwise, we have some other constant to remap.  Start by checking to see
  // if all operands have an identity remapping.

However instead of checking for identity the code was checking if the
operands were mapped to the constant itself, which is rarely true.

As a consequence, the coverage report showed that the early exit was
never taken.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270944 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 00:32:12 +00:00
Kostya Serebryany
d59f71d0d3 [libFuzzer] more refactoring: make sure CurrentUnitData is awlays a valid pointer to read from
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270942 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 00:21:33 +00:00
Mitch Bodart
f688cf78d6 [CodeGen] Fix problem with X86 byte registers in CriticalAntiDepBreaker
CriticalAntiDepBreaker was not correctly tracking defs of the high X86 byte
registers, leading to incorrect use of a busy register to break an
antidependence.

Fixes pr27681, and its duplicates pr27580, pr27804.

Differential Revision: http://reviews.llvm.org/D20456


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270935 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 23:08:52 +00:00
Easwaran Raman
639f9cbbb7 Attach profile summary in IR based instrumentation pass.
Differential revision: http://reviews.llvm.org/D20655


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270933 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 22:57:11 +00:00
Justin Bogner
f8165c02ed SDAG: Use an Optional<> instead of a sigil value. NFC
This just makes it a bit more clear that we don't intend to use a
deleted node for anything here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270931 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 22:29:34 +00:00
Kostya Serebryany
b987d27af9 [libFuzzer] more refactoring around CurrentUnit. Also add a threading test on which we currently have a race (when reporting bugs from multiple threads)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270929 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 22:17:32 +00:00
Dan Liew
bbd3f4216e [LibFuzzer] Add missing #include<string>
This partially fixes the compilation of the LibFuzzer unit test
on OSX using AppleClang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270926 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 21:54:25 +00:00
Michael Zolotukhin
642359b127 [LoopUnrollAnalyzer] Fix a crash in analyzeLoopUnrollCost.
Condition might be simplified to a Constant, but it doesn't have to be
ConstantInt, so we should dyn_cast, instead of cast.

This fixes PR27886.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270924 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 21:42:51 +00:00
Adrian Prantl
514970f03e PR26055: Speed up LiveDebugValues::transferDebugValue()
This patch builds upon r270776 and speeds up
LiveDebugValues::transferDebugValue() by adding an index that maps each
DebugVariable to its open VarLoc.

The transferDebugValue() function needs to close all open ranges for a
given DebugVariable. Iterating over the set bits of OpenRanges is
prohibitively slow in practice. I experimented with using the sorted map
of VarLocs in the UniqueVector to iterate only over the range of VarLocs
with a given DebugVariable, but the binary search turned out to be even
more expensive than just iterating over the set bits in OpenRanges.
Instead, this patch exploits the fact that there can only be one open
location for each DebugVariable and redundantly stores this location in a
DenseMap.

This patch brings the time spent in the LiveDebugValues pass down to an
almost neglectiable amount.

http://llvm.org/bugs/show_bug.cgi?id=26055
http://reviews.llvm.org/D20636
rdar://problem/24091200

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270923 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 21:42:47 +00:00
Kostya Serebryany
1c5d1efdb3 [libFuzzer] refactor: hide CurrentUnitData inside an interface function. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270922 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 21:32:30 +00:00
Chris Bieneman
7593509c1b [obj2yaml][yaml2obj] Support for MachO lazy bindings
This adds support for YAML round tripping dyld info lazy bindings. The storage and format of these is the same as regular bind opcodes, they are just interpreted differently by dyld, and can have DONE opcodes in the middle of the opcode lists.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270920 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 21:29:39 +00:00
Dan Liew
caa716a991 [LibFuzzer] Emit error if LLVM_USE_SANITIZER is not correctly set.
Previously CMake would successfully configure and compile (with warnings
about ``-fsanitize-coverage=...`` being unused) but the tests LibFuzzer
tests would fail.

Differential Revision: http://reviews.llvm.org/D20662

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270913 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 20:55:09 +00:00
Dan Liew
b82cddc56f [LibFuzzer] Allow LibFuzzer to be built in modes other than RELEASE.
Previously the flags were only being set correctly when the
build type was "Release". Now the build should work properly
for all the supported build types. When building libFuzzer
the optimization level respects whatever is used for the
rest of LLVM but for the LibFuzzer tests we force -O0.

Differential Revision: http://reviews.llvm.org/D20558

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270912 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 20:55:05 +00:00
Chris Bieneman
429d7a4cff [obj2yaml][yaml2obj] Support for MachO weak bindings
This adds support for YAML round tripping dyld info weak bindings. The storage and format of these is the same as regular bind opcodes, they are just interpreted differently by dyld.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270911 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 20:50:05 +00:00
Rafael Espindola
746036c22a coff: fix weak alias to local.
We were creating a weak external that tried to reference a static symbol. That
would always fail to link with link.exe.

We now create an external symbol in the same position as the local and refer
to that. This works with link.exe and matches what gas does.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270906 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 20:31:00 +00:00
Kostya Serebryany
ddaf22d2ba [libFuzzer] when there is a leak in the existing corpus report the reproducer properly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270905 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 20:25:49 +00:00
Richard Smith
60364032ef Don't use recursion to print out the PrettyStackTrace after a crash. If the
crash was due to a stack overflow, chances are good that this would also cause
a stack overflow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270903 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 20:21:55 +00:00
Chris Bieneman
7ad3d3b16b [obj2yaml][yaml2obj] Support for MachO bind opcodes
This adds support for YAML round tripping dyld info bind opcodes. Bind opcodes can have signed or unsigned LEB128 data, and they can have symbols associated with them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270901 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 20:06:14 +00:00
Kostya Serebryany
34fca4b9ec [libFuzzer] reimplement the way we do -only_ascii to allow more 'const' in function declarations. Add a test for -only_ascii. NFC intended
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270900 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 20:03:02 +00:00
Krzysztof Parzyszek
fd1e14e505 [Hexagon] Enable the post-RA scheduler
The aggressive anti-dependency breaker can rename the restored callee-
saved registers. To prevent this, mark these registers are live on all
paths to the return/tail-call instructions, and add implicit use operands
for them to these instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270898 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 19:44:28 +00:00
Chad Rosier
6b9dd0cef1 [AArch64] Generate rev16/rev32 from bswap + srl when upper bits are known zero.
Canonicalize (srl (bswap i32 x), 16) to (rotr (bswap i32 x), 16), if the high
16-bits of x are zero. Similarly, canonicalize (srl (bswap i64 x), 32) to
(rotr (bswap i64 x), 32), if the high 32-bits of x are zero.

test_rev_w_srl16:            test_rev_w_srl16:
  and w8, w0, #0xffff          and     w8, w0, #0xffff
  rev w8, w8           --->    rev16   w0, w8
  lsr     w0, w8, #16

test_rev_x_srl32:            test_rev_x_srl32:
  rev x8, x8           --->    rev32   x0, x8
  lsr x0, x8, #32

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270896 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 19:41:33 +00:00
Changpeng Fang
faf7289db3 AMDGPU/SI: Enable load-store-opt by default.
Summary: Enable load-store-opt by default, and update LIT tests.

Reviewers: arsenm

Differential Revision: http://reviews.llvm.org/D20694

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270894 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 19:35:29 +00:00
Michael Kuperstein
b80d8daba8 [BasicAA] Extend inbound GEP negative offset logic to GlobalVariables
r270777 improved the precision of alloca vs. inbounbds GEP alias queries: if
we have (a) an inbounds GEP and (b) a pointer based on an alloca, and the
beginning of the object the GEP points to would have a negative offset with
respect to the alloca, then the GEP can not alias pointer (b).

This makes the same logic fire when (b) is based on a GlobalVariable instead
of an alloca.

Differential Revision: http://reviews.llvm.org/D20652


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270893 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 19:30:49 +00:00
David Majnemer
4b3bb8d03e [MemCpyOpt] Don't perform callslot optimization across may-throw calls
An exception could prevent a store from occurring but MemCpyOpt's
callslot optimization would fire anyway, causing the store to occur.

This fixes PR27849.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270892 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 19:24:24 +00:00
Rafael Espindola
8d48aba10b coff: fix the section of weak symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270889 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 18:48:23 +00:00
Michael Kuperstein
a8a201a894 [BBVectorize] Don't vectorize selects with a scalar condition and vector operands.
This fixes PR27879.

Differential Revision: http://reviews.llvm.org/D20659


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270888 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 18:43:57 +00:00
Krzysztof Parzyszek
e19980c408 Do not rename registers that do not start an independent live range
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270885 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 18:22:53 +00:00
Rafael Espindola
018780927c coff: fix the value of weak definitions.
It looks like this doesn't get a lot of use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270883 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 18:04:53 +00:00
Pete Cooper
18a6f17098 Don't allocate in APInt::slt. NFC.
APInt::slt was copying the LHS and RHS in to temporaries then making
them unsigned so that it could use an unsigned comparision.  It did
this even on the paths which were trivial to give results for, such
as the sign bit of the LHS being set while RHS was not set.

This changes the logic to return out immediately in the trivial cases,
and use an unsigned comparison in the remaining cases.  But this time,
just use the unsigned comparison directly without creating any temporaries.

This works because, for example:
  true = (-2 slt -1) = (0xFE ult 0xFF)

Also added some tests explicitly for slt with APInt's larger than 64-bits
so that this new code is tested.

Using the memory for 'opt -O2 verify-uselistorder.lto.opt.bc -o opt.bc'
(see r236629 for details), this reduces the number of allocations from
26.8M to 23.9M.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270881 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 17:40:07 +00:00
David Majnemer
9139142972 [CaptureTracking] Volatile operations capture their memory location
The memory location that corresponds to a volatile operation is very
special.  They are observed by the machine in ways which we cannot
reason about.

Differential Revision: http://reviews.llvm.org/D20555

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270879 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 17:36:22 +00:00
Artem Belevich
c1645b33e4 Init member structs in constructor.
Fixes build error on windows where MSVC does not
support list initialization inside member initializer list.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270877 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 17:29:20 +00:00
Xinliang David Li
f18a32f1af Revert 270865 -- unexplained bot failure on linux/ppcle
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270876 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 17:27:22 +00:00
Lang Hames
69bb6054b5 [Orc] Merge some common code for creating CompileCallbackManagers and
IndirectStubsManagers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270874 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 17:20:35 +00:00