102419 Commits

Author SHA1 Message Date
Michael Zolotukhin
805e09d964 [SCEV] createAddRecFromPHI: Optimize for the most common case.
Summary:
The existing implementation creates a symbolic SCEV expression every
time we analyze a phi node and then has to remove it, when the analysis
is finished. This is very expensive, and in most of the cases it's also
unnecessary. According to the data I collected, ~60-70% of analyzed phi
nodes (measured on SPEC) have the following form:
  PN = phi(Start, OP(Self, Constant))
Handling such cases separately significantly speeds this up.

Reviewers: sanjoy, pete

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302096 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 23:53:38 +00:00
Craig Topper
e6aa7aa29e [InstCombine][KnownBits] Use KnownBits better to detect nsw adds
Change checkRippleForAdd from a heuristic to a full check -
if it is provable that the add does not overflow return true, otherwise false.

Patch by Yoav Ben-Shalom

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302093 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 23:22:46 +00:00
Reid Kleckner
6e53fe29f3 Mark functions as not having CFI once we finalize an x86 stack frame
We'll set it back to true in emitPrologue if it gets called. It doesn't
get called for naked functions.

Fixes PR32912

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302092 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 23:13:42 +00:00
Craig Topper
64c8cdfd4f [KnownBits] Add methods for determining if KnownBits is a constant value
This patch adds isConstant and getConstant for determining if KnownBits represents a constant value and to retrieve the value. Use them to simplify code.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302091 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 23:12:29 +00:00
Craig Topper
f990516387 [ValueTracking] Remove handling for BitWidth being 0 in ComputeSignBit and isKnownNonZero.
I don't believe its possible to have non-zero values here since DataLayout became required. The APInt constructor inside of the KnownBits object will assert if this ever happens.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302089 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 22:25:19 +00:00
Craig Topper
f78221855b [KnownBits] Add zext, sext, and trunc methods to KnownBits
This patch adds zext, sext, and trunc methods to KnownBits and uses them where possible.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302088 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 22:07:25 +00:00
Sanjay Patel
acf74d2493 [TargetLowering] use isSubsetOf in SimplifyDemandedBits; NFCI
This is the DAG equivalent of https://reviews.llvm.org/D32255 , 
which will hopefully be committed again. The functionality
(preferring a 'not' op) is already here in the DAG, so this is
just intended to be a clean-up and performance improvement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302087 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 21:55:34 +00:00
Paul Robinson
2dbf23f50c clang-format and restyle DWARFFormValue before working on it. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302086 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 21:53:21 +00:00
Saleem Abdulrasool
9de7130986 DebugInfo: elide type index entries for synthetic types
Compiler emitted synthetic types may not have an associated DIFile
(translation unit).  In such a case, when generating CodeView debug type
information, we would attempt to compute an absolute filepath which
would result in a segfault due to a NULL DIFile*.  If there is no source
file associated with the type, elide the type index entry for the type
and record the type information.  This actually results in higher
fidelity debug information than clang/C2 as of this writing.

Resolves PR32668!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302085 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 21:39:01 +00:00
Ahmed Bougacha
d7e3981fae [AArch64] Fix variable name ambiguity in r302078.
ArchKind is passed to the function, but it's also a type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302081 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 20:51:34 +00:00
Xin Tong
2b3efc4c39 [TailCallElim] Remove an unused argument. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302080 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 20:37:07 +00:00
Ahmed Bougacha
f007e3acca [AArch64] Make the TargetParser add CPU exts provided by the arch.
Otherwise, each CPU has to manually specify the extensions it supports,
even though they have to be a superset of the base arch extensions.
And when there's redundant data there's stale data, so most of the CPUs
lie about the features they support (almost none lists AEK_FP).

Instead, do the saner thing: add the optional extensions on top of the
base extensions provided by the architecture.

The ARM TargetParser has the same behavior.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302078 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 20:33:58 +00:00
Ahmed Bougacha
700df98ddd [AArch64] armv8-A doesn't have CRC.
That's only a required extension as of v8.1a.

Remove it from the "generic" CPU as well: it should only support the
base ISA (and binutils agrees).

Also unify the MC tests into crc.s and arm64-crc32.s

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302077 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 20:33:52 +00:00
Vitaly Buka
0a73805541 [libFuzzer] exit without running atexit handlers in libfuzzer's crash handler
Summary:
It's not safe to assume that atexit handlers can be run once the app crashed.

Patch by Jochen Eisinger.

Reviewers: kcc, vitalybuka

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302076 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 20:31:19 +00:00
Krzysztof Parzyszek
c272a4dc8d [Hexagon] Use automatically-generated scheduling information for HVX
Patch by Jyotsna Verma.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302073 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 20:10:36 +00:00
Zachary Turner
2a1f47ab11 Remove unused private field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302069 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 19:42:06 +00:00
Anna Thomas
f931b1e7f3 Avoid warning of unused variable in release builds. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302068 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 19:25:04 +00:00
Sanjoy Das
822fa3007b Fix typos in comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302063 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 18:29:34 +00:00
Greg Clayton
40ec86bcc2 Break verification down into smaller functions to keep code clean.
Adrian requested that we break things down to make things clean in the DWARFVerifier. This patch breaks everything down into nice individual functions and cleans up the code quite a bit and prepares us for the next round of verifiers.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302062 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 18:25:46 +00:00
Anna Thomas
48d0c2805c Fix PPC64 warning for missing parantheses. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302061 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 18:25:43 +00:00
Reid Kleckner
a82b376f69 [IR] Abstract away ArgNo+1 attribute indexing as much as possible
Summary:
Do three things to help with that:
- Add AttributeList::FirstArgIndex, which is an enumerator currently set
  to 1. It allows us to change the indexing scheme with fewer changes.
- Add addParamAttr/removeParamAttr. This just shortens addAttribute call
  sites that would otherwise need to spell out FirstArgIndex.
- Remove some attribute-specific getters and setters from Function that
  take attribute list indices.  Most of these were only used from
  BuildLibCalls, and doesNotAlias was only used to test or set if the
  return value is malloc-like.

I'm happy to split the patch, but I think they are probably easier to
review when taken together.

This patch should be NFC, but it sets the stage to change the indexing
scheme to this, which is more convenient when indexing into an array:
  0: func attrs
  1: retattrs
  2...: arg attrs

Reviewers: chandlerc, pete, javed.absar

Subscribers: david2050, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302060 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 18:17:31 +00:00
Davide Italiano
b95636bcab [CodeView] Remove constructor initialization of a removed field.
I should've staged this with my last commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302059 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 18:02:46 +00:00
Anna Thomas
b93df0801a [RuntimeLoopUnroller] Add assert that we dont unroll non-rotated loops
Summary:
Cloning basic blocks in the loop for runtime loop unroller depends on loop being
in rotated form (i.e. loop latch target is the exit block).
Assert that this is true, so that callers of runtime loop unroller pass in
canonical loops.
The single caller of this function has that check recently added:
https://reviews.llvm.org/rL301239

Reviewers: davide

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302058 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 17:43:59 +00:00
Alexei Starovoitov
bd87726db4 [bpf] add relocation support
. there should be no runtime relocation inside the bpf function.
  . relocation supported here mostly for debugging.
  . a test case is added.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302055 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 17:30:56 +00:00
Zachary Turner
ff94599664 [CodeView] Use actual strings for dealing with checksums and lines.
The raw CodeView format references strings by "offsets", but it's
confusing what table the offset refers to.  In the case of line
number information, it's an offset into a buffer of records,
and an indirection is required to get another offset into a
different table to find the final string.  And in the case of
checksum information, there is no indirection, and the offset
refers directly to the location of the string in another buffer.

This would be less confusing if we always just referred to the
strings by their value, and have the library be smart enough
to correctly resolve the offsets on its own from the right
location.

This patch makes that possible.  When either reading or writing,
all the user deals with are strings, and the library does the
appropriate translations behind the scenes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302053 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 17:11:40 +00:00
Zachary Turner
f393f97e65 [llvm-readobj] Update readobj to re-use parsing code.
llvm-readobj hand rolls some CodeView parsing code for string
tables, so this patch updates it to re-use some of the newly
introduced parsing code in LLVMDebugInfoCodeView.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302052 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 17:11:11 +00:00
Simon Pilgrim
2cd10f6a97 [X86][LWP] Add stack folding mappings and tests for LWPINS/LWPVAL instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302049 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 16:46:30 +00:00
Simon Pilgrim
d27e7d384a Silence a 'enum and non-enum used in conditional' warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302048 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 16:43:57 +00:00
Amaury Sechet
d161fb6774 [DAGCombine] (addcarry (add|uaddo X, Y), 0, Carry) -> (addcarry X, Y, Carry)
Summary: Do the transform when the carry isn't used. It's a pattern exposed when legalizing large integers.

Reviewers: jyknight, nemanjai, mkuper, spatel, RKSimon, zvi, bkramer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302047 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 16:28:10 +00:00
Greg Clayton
c8e3032271 Create DWARFVerifier.cpp and .h and move all DWARF verification code over into it.
Adrian requested we create a DWARFVerifier.cpp file to contain all of the DWARF verification stuff. This change simply moves the functionality over into DWARFVerifier.h and DWARFVerifier.cpp, renames the DWARFVerifier methods to start with lower case, and switches DWARFContext.cpp over to using the new functionality.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302044 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 16:02:29 +00:00
Zachary Turner
6b4b26a1a7 Resubmit r301986 and r301987 "Add codeview::StringTable"
This was reverted due to a "missing" file, but in reality
what happened was that I renamed a file, and then due to
a merge conflict both the old file and the new file got
added to the repository.  This led to an unused cpp file
being in the repo and not referenced by any CMakeLists.txt
but #including a .h file that wasn't in the repo.  In an
even more unfortunate coincidence, CMake didn't report the
unused cpp file because it was in a subdirectory of the
folder with the CMakeLists.txt, and not in the same directory
as any CMakeLists.txt.

The presence of the unused file was then breaking certain
tools that determine file lists by globbing rather than
by what's specified in CMakeLists.txt

In any case, the fix is to just remove the unused file from
the patch set.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302042 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 15:58:37 +00:00
Simon Pilgrim
9226f72364 [X86][LWP] Add llvm support for LWP instructions (reapplied).
This patch adds support for the the LightWeight Profiling (LWP) instructions which are available on all AMD Bulldozer class CPUs (bdver1 to bdver4).

Reapplied - this time without changing line endings of existing files.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302041 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 15:51:39 +00:00
Craig Topper
52bc9d9102 [APInt] Give the value union a name so we can remove assumptions on VAL being the larger member
Currently several places assume the VAL member is always at least the same size as pVal. In particular for a memcpy in the move assignment operator. While this is a true assumption, it isn't good practice to assume this.

This patch gives the union a name so we can write the memcpy in terms of the union itself. This also adds a similar memcpy to the move constructor where we previously just copied using VAL directly.

This patch is mostly just a mechanical addition of the U in front of VAL and pVAL everywhere. But several constructors had to be modified since we can't directly initializer a field of named union from the initializer list.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302040 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 15:46:24 +00:00
Greg Clayton
8364badbd9 Verify that no compile units share the same line table in "llvm-dwarfdump --verify"
Check to make sure no compile units have the same DW_AT_stmt_list values. Report a verification error if they do.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302039 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 15:45:31 +00:00
Simon Pilgrim
dad8f545ae Revert rL302028 due to accidental line ending changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302038 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 15:42:29 +00:00
Krzysztof Parzyszek
30c3f70068 [Hexagon] Handle S2_storerf_io in HexagonInstrInfo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302036 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 15:36:51 +00:00
Krzysztof Parzyszek
0685f416f9 [Hexagon] Misc fixes in HexagonInstrInfo, NFC
Formatting changes + remove unused function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302035 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 15:34:52 +00:00
Krzysztof Parzyszek
6da858a291 [Hexagon] Adjust latency between allocframe and the first store on stack
Allocframe and the following stores on the stack have a latency of 2 cycles
when not in the same packet. This happens because R29 is needed early by the
store instruction. Since one of such stores can be packetized along with
allocframe and use old value of R29, we can assign it 0 cycle latency
while leaving latency of other stores to the default value of 2 cycles.

Patch by Jyotsna Verma.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302034 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 15:33:09 +00:00
Krzysztof Parzyszek
b866debf20 [Hexagon] Handle J2_jumptpt and J2_jumpfpt in HexagonInstrInfo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302033 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 15:30:46 +00:00
Krzysztof Parzyszek
7cff8063d1 [Hexagon] Implement undoing .cur instructions in packetizer
The packetizer needs to convert .cur instruction to its regular form if
the use is not in the same packet as the .cur. The code in the packetizer
handles one type of .cur, which is the vector load case. This patch
updates the packetizer so that it can undo all the .cur instructions.
In the test case, the .cur is the 128B version, but there are also the
post-increment versions.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302032 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 15:28:56 +00:00
Krzysztof Parzyszek
2f1d015824 [Hexagon] Add memory operands to a rewritten load
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302030 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 15:26:13 +00:00
Krzysztof Parzyszek
7812bede76 [Hexagon] Reset spill alignment when variable-sized objects are present
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302029 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 15:23:53 +00:00
Simon Pilgrim
0766da9258 [X86][LWP] Add llvm support for LWP instructions.
This patch adds support for the the LightWeight Profiling (LWP) instructions which are available on all AMD Bulldozer class CPUs (bdver1 to bdver4).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302028 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 15:18:34 +00:00
Guy Blank
cb866d20a6 [X86][AVX512] remove unnecessary case. NFC
VFPCLASS is for vector types and not scalar, so it cannot get here.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302023 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 13:34:05 +00:00
Jonas Paulsson
0441b20083 [SystemZ] Properly check number of operands in getCmpOpsType()
It is needed to check that the number of operands are 2 when
finding the case of a logic combination, e.g. 'and' of two compares.

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302022 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 13:33:45 +00:00
Oren Ben Simhon
5bbf1b2a54 [X86] Support of no_caller_saved_registers attribute
This patch implements the LLVM part for no_caller_saved_registers attribute as appears here: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5ed3cc7b66af4758f7849ed6f65f4365be8223be.
In order to implement the attribute, we use the dynamic CSR mechanism to remove returned/passed arguments from the function regmask/CSR list.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302020 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 13:07:19 +00:00
Elad Cohen
ea59a24717 Support arbitrary address space pointers in masked gather/scatter intrinsics.
Fixes PR31789 - When loop-vectorize tries to use these intrinsics for a
non-default address space pointer we fail with a "Calling a function with a
bad singature!" assertion. This patch solves this by adding the 'vector of
pointers' argument as an overloaded type which will determine the address
space.

Differential revision: https://reviews.llvm.org/D31490



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302018 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 12:28:54 +00:00
Dylan McKay
6804210951 [AVR] Reserve the Y register in all functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302017 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 11:56:01 +00:00
Anna Thomas
469af3f37f [Loop Deletion] Delete loops that are never executed
Summary:
Currently, loop deletion deletes loop where the only values
that are used outside the loop are loop-invariant.
This patch adds logic to delete loops where the loop is proven to be
never executed (i.e. the only predecessor of the loop preheader has a
constant conditional branch as terminator, and the preheader is not the
taken target). This will remove loops that become dead after
loop-unswitching generates constant conditional branches.

The next steps are:
1. moving the loop deletion implementation to LoopUtils.
2. Add logic in loop-simplifyCFG which will support changing conditional
constant branches to unconditional branches. If loops become unreachable in this
process, they can be removed using `deleteDeadLoop` function.

Reviewers: chandlerc, efriedma, sanjoy, reames

Reviewed by: sanjoy

Subscribers: mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302015 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 11:47:11 +00:00
Dylan McKay
8ec2e3efa4 Revert "[AVR] Enable the frame pointer for all functions"
This reverts commit 358ad02d999e88853d2cfc954bd2f668308a51f7.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302014 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-03 11:36:42 +00:00