147595 Commits

Author SHA1 Message Date
Jan Sjodin
465e205500 Add MachineRegionInfoPassID to Passes.h.
Differential Revision: https://reviews.llvm.org/D31899



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299932 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 11:40:55 +00:00
Diana Picus
0a032476a5 GlobalISel: Allow legalizing G_FADD to a libcall
Use the same handling in the generic legalizer code as for the other
libcalls (G_FREM, G_FPOW).

Enable it on ARM for float and double so we can test it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299931 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 10:52:34 +00:00
Volkan Keles
e49d0dbf86 [GlobalISel] LegalizerInfo: Enable legalization of non-power-of-2 types
Summary: Legalize only if the type is marked as Legal or Custom. If not, return Unsupported as LegalizerHelper is not able to handle non-power-of-2 types right now.

Reviewers: qcolombet, aditya_nandakumar, dsanders, t.p.northover, kristof.beyls, javed.absar, ab

Reviewed By: kristof.beyls, ab

Subscribers: dberris, rovka, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299929 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 10:10:14 +00:00
Diana Picus
1d02724c71 Revert "Turn some C-style vararg into variadic templates"
This reverts commit r299925 because it broke the buildbots. See e.g.
http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/6008

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299928 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 10:07:12 +00:00
Sam Parker
4714fdf595 [SelectionDAG] Check CALLSEQ_BEGIN nodes in DelayForLiveRegs
A fix for the bug reported in PR30911.

The issue arises when multiple CALLSEQ_BEGIN nodes are unscheduled as
the last node to be unscheduled will gain access to the CallResource
register. But when a node is being picked, only CALLSEQ_END nodes are
checked against the CallResource and have their chains evaluated.
This then means that other CALLSEQ_BEGIN nodes can be scheduled
before the existing call sequence has been finalised. This patch adds
a check against the FrameSetup nodes in DelayForLiveRegs to prevent
this from happening.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299926 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 08:43:32 +00:00
Serge Guelton
ec124b3a6f Turn some C-style vararg into variadic templates
Module::getOrInsertFunction is using C-style vararg instead of
variadic templates.

From a user prospective, it forces the use of an annoying nullptr
to mark the end of the vararg, and there's not type checking on the
arguments. The variadic template is an obvious solution to both
issues.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299925 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 08:36:52 +00:00
Sylvestre Ledru
262869e2bf Simplify the code and remove dead code
Summary: Fix coverity cid 1374240

Reviewers: dberlin

Reviewed By: dberlin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299924 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 08:21:27 +00:00
Craig Topper
cd0241d19a [IR] Fix a typo in a comment. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299918 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 06:41:55 +00:00
Craig Topper
c2741201b5 [InstCombine] Refinement of r299915. Only consider a ConstantVector for Neg if all the elements are Undef or ConstantInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299917 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 06:32:48 +00:00
Craig Topper
70fe0347f5 [InstCombine] Support weird size element types in dyn_castNegVal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299915 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 05:42:47 +00:00
Sanjoy Das
861af97ffa [LoopUnswitch] Fix a test case
(h/t to Chandler for pointing this out)

The test in question was not at all testing what it was supposed to
test.  We do not //care// about placing `!make.implicit` in inner
constant branch (since it will be folded away anyway).  We care about
placing `!make.implicit` in the outer branch that switches between
either version of the loop.

Having said that, it is _correct_ to leave behind the `!make.implicit`
in the inner branch, but there is no need to do so.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299912 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 04:11:47 +00:00
Hal Finkel
bf06691a18 [LICM] Hoist fp division from the loops and replace by a reciprocal
When allowed, we can hoist a division out of a loop in favor of a
multiplication by the reciprocal. Fixes PR32157.

Patch by vit9696!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299911 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 02:22:54 +00:00
Hal Finkel
7ddaf9fa1f [PowerPC] multiply-with-overflow might use the CTR register
Check the legality of ISD::[US]MULO to see whether
Intrinsic::[us]mul_with_overflow will legalize into a function call (and, thus,
will use the CTR register).  Fixes PR32485.

Patch by Tim Neumann!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299910 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 02:03:17 +00:00
Hal Finkel
a65ac0dca0 [bugpoint] Also remove comdat's from externalized GVs
We were removing comdats from externalized functions (function declarations
can't be comdat), but were not doing the same for variable. Failure to do this
would cause bugpoint to fail ("Declaration may not be in a Comdat!").

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299908 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 00:18:42 +00:00
Reid Kleckner
a8ca30150c [IR] Sink some AttributeListImpl methods out of headers NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299906 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 00:16:00 +00:00
Daniel Berlin
f47b8f1cd1 Revert "NewGVN: Don't propagate over phi backedges where undef causes us to have >1 value."
It's not ready yet this was an accidental commit :(

This reverts r299903

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299904 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 00:07:26 +00:00
Daniel Berlin
7708dd836f NewGVN: Don't propagate over phi backedges where undef causes us to have >1 value.
Fixes PR 32607.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299903 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 00:02:38 +00:00
Reid Kleckner
e937c5e12f Remove AttributeSetNode::get(AttributeList, unsigned) and sink constructor
The getter was equivalent to AttributeList::getAttributes(unsigned),
which seems like a better way to express getting the AttributeSet for a
given index. This static helper was only used in one place anyway.

The constructor doesn't benefit from inlining and doesn't need to be in
a header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299900 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 23:46:08 +00:00
Reid Kleckner
7dde8e89fc Reland "[IR] Make AttributeSetNode public, avoid temporary AttributeList copies"
This re-lands r299875.

I introduced a bug in Clang code responsible for replacing K&R, no
prototype declarations with a real function definition with a prototype.
The bug was here:

       // Collect any return attributes from the call.
  -    if (oldAttrs.hasAttributes(llvm::AttributeList::ReturnIndex))
  -      newAttrs.push_back(llvm::AttributeList::get(newFn->getContext(),
  -                                                  oldAttrs.getRetAttributes()));
  +    newAttrs.push_back(oldAttrs.getRetAttributes());

Previously getRetAttributes() carried AttributeList::ReturnIndex in its
AttributeList. Now that we return the AttributeSetNode* directly, it no
longer carries that index, and we call this overload with a single node:
  AttributeList::get(LLVMContext&, ArrayRef<AttributeSetNode*>)

That aborted with an assertion on x86_32 targets. I added an explicit
triple to the test and added CHECKs to help find issues like this in the
future sooner.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299899 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 23:31:05 +00:00
Sanjay Patel
ed488fa93d [ARM, x86] add tests to show possible improvement for bool math; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299897 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 23:26:31 +00:00
Davide Italiano
a2e505ede0 [NewGVN] Surround with parens to clarify allegedly ambiguous precedence.
This Placates GCC7 with -Werror. Also, clang-format the assertions
while I'm here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299895 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 23:08:35 +00:00
Davide Italiano
21197c2fc5 [MemorySSA] We don't need to compute dominator levels anymore.
Differential Revision:  https://reviews.llvm.org/D31818

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299893 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 22:44:46 +00:00
Kyle Butt
663903f2e8 CodeGen: BlockPlacement: Don't always tail-duplicate with no other successor.
The math works out where it can actually be counter-productive. The probability
calculations correctly handle the case where the alternative is 0 probability,
rely on those calculations.

Includes a test case that demonstrates the problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299892 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 22:28:22 +00:00
Kyle Butt
132e8441ed CodeGen: BlockPlacement: Minor probability changes.
Qin may be large, and Succ may be more frequent than BB. Take these both into
account when deciding if tail-duplication is profitable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299891 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 22:28:18 +00:00
Kyle Butt
ad1b74fa7d CodeGen: BranchFolding: Merge identical blocks, even if they are short.
Merging identical blocks when it doesn't reduce fallthrough. It is common for
the blocks created from critical edge splitting to be identical. We would like
to merge these blocks whenever doing so would not reduce fallthrough.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299890 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 22:28:12 +00:00
Matt Arsenault
e0b3c335a2 Allow DataLayout to specify addrspace for allocas.
LLVM makes several assumptions about address space 0. However,
alloca is presently constrained to always return this address space.
There's no real way to avoid using alloca, so without this
there is no way to opt out of these assumptions.

The problematic assumptions include:
- That the pointer size used for the stack is the same size as
  the code size pointer, which is also the maximum sized pointer.

- That 0 is an invalid, non-dereferencable pointer value.

These are problems for AMDGPU because alloca is used to
implement the private address space, which uses a 32-bit
index as the pointer value. Other pointers are 64-bit
and behave more like LLVM's notion of generic address
space. By changing the address space used for allocas,
we can change our generic pointer type to be LLVM's generic
pointer type which does have similar properties.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299888 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 22:27:50 +00:00
Eric Christopher
400ee3160b Get the TOC save offset off of PPCFrameLowering rather than a separate copy of the same data.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299887 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 22:22:11 +00:00
Peter Collingbourne
995bc5b095 Bitcode: Merge the code for parsing global value module codes in the summary bitcode reader. NFCI.
This code will need to be taught to handle string tables and it's better if
there is only one copy of it.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299886 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 21:17:54 +00:00
Dehao Chen
5c741f7437 Emit less compiler optimization remarks in samplepgo to reduce a call to findCalleeFunctionSamples which is going to be refactored.
Summary: Now the SamplePGO support is more stable, we do not need so many verbose optimization remarks emitted.

Reviewers: dnovillo, davidxl

Reviewed By: davidxl

Subscribers: fhahn, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299883 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 20:49:16 +00:00
Geoff Berry
c6b073116e [GVNHoist] Call isGuaranteedToTransferExecutionToSuccessor on each instruction
w.r.t. https://bugs.llvm.org/show_bug.cgi?id=32153
The consensus seems to be isGuaranteedToTransferExecutionToSuccessor should be called for each function.

Patch by Aditya Kumar

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299882 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 20:45:17 +00:00
Evgeniy Stepanov
465b9a5c3d Revert "[asan] Put ctor/dtor in comdat."
This reverts commit r299696, which is causing mysterious test failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299880 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 20:36:36 +00:00
Evgeniy Stepanov
9cf476f311 Revert "[asan] Fix dead stripping of globals on Linux."
This reverts commit r299697, which caused a big increase in object file size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299879 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 20:36:30 +00:00
Reid Kleckner
d5d5d0b80e Revert "[IR] Make AttributeSetNode public, avoid temporary AttributeList copies"
This reverts r299875. A Linux bot came back with a test failure:
http://bb.pgr.jp/builders/test-clang-i686-linux-RA/builds/741/steps/test_clang/logs/Clang%20%3A%3A%20CodeGen__2006-05-19-SingleEltReturn.c

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299878 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 20:34:19 +00:00
Matt Arsenault
bdbe8280f2 Add address space mangling to lifetime intrinsics
In preparation for allowing allocas to have non-0 addrspace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299876 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 20:18:21 +00:00
Reid Kleckner
a8b5a980c8 [IR] Make AttributeSetNode public, avoid temporary AttributeList copies
Summary:
AttributeList::get(Fn|Ret|Param)Attributes no longer creates a temporary
AttributeList just to hide the AttributeSetNode type.

I've also added a factory method to create AttributeLists from a
parallel array of AttributeSetNodes. I think this simplifies
construction of AttributeLists when rewriting function prototypes.
Previously we would test if a particular index had attributes, and
conditionally add a temporary attribute list to a vector. Now the
attribute set vector is parallel to the argument vector already that
these passes already construct.

My long term vision is to wrap AttributeSetNode* inside an AttributeSet
type that holds the enum attributes, but that will come in a follow up
change.

I haven't done any performance measurements for this change because
profiling hasn't shown that any of the affected code is hot.

Reviewers: pete, chandlerc, sanjoy, hfinkel

Reviewed By: pete

Subscribers: jfb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299875 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 20:18:10 +00:00
Reid Kleckner
df685624d0 Remove svn:eol-style properties from some files so 'git llvm push' works for them
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299874 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 20:16:54 +00:00
Zachary Turner
c29751d1b4 Fix signed / unsigned comparison warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299873 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 20:01:50 +00:00
Simon Atanasyan
20b5e3ba0b [mips] Use Triple::isLittleEndian to check endianness. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 19:42:44 +00:00
Sanjay Patel
4ac99f71cc [InstCombine] improve variable names; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299871 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 19:38:36 +00:00
Craig Topper
a0e581d63e [InstSimplify] Use cast instead of dyn_cast after isa<> check. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299870 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 19:37:10 +00:00
Zachary Turner
e98c913509 [llvm-pdbdump] Display padding bytes on record layout
When dumping classes, show where padding occurs, and at the end of the
class print statistics about how many bytes total of padding exist in a
class.

Since PDB doesn't specifically contain information about padding, we have
to mimic this by sort of reversing a small portion of the record layout
algorithm (e.g. looking at offsets and sizes and trying to determine
whether something is part of the same field or a new field).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299869 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 19:33:29 +00:00
Matt Arsenault
9b5d7f6374 [MemCpyOpt] Only replace memcpy with bitcast if address spaces match
Patch by James Price

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299866 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 19:00:25 +00:00
Daniel Berlin
13d8288f8e MemorySSA: Make lifetime starts defs for mustaliased pointers
Summary:
While we don't want them aliasing with other pointers, there seems to
be no point in not having them clobber must-aliased'd pointers.

If some day, we split the aliasing and ordering chains, we'd make this
not aliasing but an ordering barrier (IE it doesn't affect it's
memory, but we can't hoist it above it).

Reviewers: hfinkel, george.burgess.iv

Subscribers: Prazek, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299865 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 18:46:00 +00:00
Matthew Simpson
42df88e1f8 [ARM/AArch64] Ensure valid vector element types for interleaved accesses
This patch refactors and strengthens the type checks performed for interleaved
accesses. The primary functional change is to ensure that the interleaved
accesses have valid element types. The added test cases previously failed
because the element type is f128.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299864 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 18:34:37 +00:00
Craig Topper
f4272d1c37 [InstCombine] Use commutable matchers and m_OneUse in visitSub to shorten code. Add missing test cases.
In one case I removed commute handling for a multiply with a constant since we'll eventually get the constant on the right hand side.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299863 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 18:09:25 +00:00
Matt Arsenault
40cf5b3d29 AMDGPU: Fix crash when disassembling VOP3 mac
The unused dummy src2_modifiers is missing, so it crashes
when trying to print it.

I tried to fully remove src2_modifiers, but there are some
irritations in the places where it is converted to mad since
it starts to require modifying use lists while iterating over
them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299861 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 17:58:06 +00:00
Zachary Turner
a360984c0b [Support] Add support for finding unset bits in a BitVector.
BitVector had methods for searching for the first and next
set bits, but it did not have analagous methods for finding
the first and next unset bits.  This is useful when your ones
and zeros are grouped together and you want to iterate over
ranges of ones and zeros.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299857 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 17:18:54 +00:00
Zachary Turner
d2f46ef6a6 Fix line endings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299856 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 17:17:11 +00:00
Zachary Turner
08a5893e91 Remove eol-style:native from BitVector.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299855 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 17:15:11 +00:00
Craig Topper
0a52d06b89 [InstCombine] Use m_c_Add to shorten some code. Add testcases for this fold since they were missing. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299853 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 16:59:40 +00:00