Commit Graph

141925 Commits

Author SHA1 Message Date
Peter Collingbourne
85ea24d6da Support: Use a 64-bit seek in raw_fd_ostream::seek().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289184 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 04:57:19 +00:00
Davide Italiano
11200e161b [SCCP] Make the test added in r289175 more meaningful.
Add a comment while here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289182 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 03:49:20 +00:00
Davide Italiano
45b7e0e48d [SCCP] Teach the pass about mul %x 0 even if %x is overdefined.
The motivating example is:

extern int patatino;
int goo() {
    int x = 0;
    for (int i = 0; i < 1000000; ++i) {
        x *= patatino;
    }
    return x;
}

Currently SCCP will not realize that this function returns always zero,
therefore will try to unroll and vectorize the loop at -O3 producing an
awful lot of (useless) code. With this change, it will just produce:

0000000000000000 <g>:
   xor    %eax,%eax
   retq

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289175 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 03:08:42 +00:00
Craig Topper
54d8245b23 [AVX-512] Add vpermilps/pd to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289173 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 02:18:11 +00:00
Craig Topper
d80aa69605 [AVX-512] Move some floating point stack folding test cases out of the integer test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289172 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 02:18:07 +00:00
Craig Topper
c341071db3 [Analysis] Fix typo in comment. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289171 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 02:18:04 +00:00
Kostya Serebryany
a3def13005 [libFuzzer] implement crash-resistant merge (https://github.com/google/sanitizers/issues/722). This is a first experimental variant that needs some more testing, thus not yet adding a lit test (but there are unit tests).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289166 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 01:17:24 +00:00
Peter Collingbourne
c8e39ef801 WholeProgramDevirt: Teach the pass to handle structs of arrays.
This will become necessary in some cases once D22296 lands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289165 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 01:10:11 +00:00
Chandler Carruth
410e7953c3 [LCG] Minor cleanup to the LCG walk over a function, NFC.
This just hoists the check for declarations up a layer which allows
various sets used in the walk to be smaller. Also moves the relevant
comments to match, and catches a few other cleanups in this code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289163 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 00:46:44 +00:00
Peter Collingbourne
5ecad331e4 Make WholeProgramDevirt understand ConstStruct vtables.
Based on a patch by LemonBoy!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289162 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 00:33:27 +00:00
Chris Bieneman
18245f6cf7 [ObjectYAML] Support for DWARF debug_aranges
This patch adds support for round tripping DWARF debug_aranges in and out of YAML.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289161 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 00:26:44 +00:00
Sanjay Patel
c828f5b04a [InstCombine] add tests for umin+icmp; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289157 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 23:44:58 +00:00
Sanjay Patel
d0dc2aae8c [InstCombine] add tests for umax+icmp; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289156 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 23:36:57 +00:00
Zia Ansari
ea5455c788 [InstSimplify] Add "X / 1.0" to SimplifyFDivInst.
Differential Revision: https://reviews.llvm.org/D27587


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289153 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 23:27:40 +00:00
Sanjay Patel
0261b12fff [InstCombine] add tests for smax+icmp; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289151 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 23:16:06 +00:00
Tim Northover
a6b6846c2f GlobalISel: fall back gracefully for debug intrinsics.
Supporting them properly is a reasonably complex chunk of work, so to allow bot
testing before then we should at least be able to fall back to DAG ISel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289150 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 22:44:13 +00:00
Tim Northover
8fd7b713cc GlobalISel: factor overflow handling into separate function. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289149 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 22:44:00 +00:00
Davide Italiano
a47129de89 [SCCP] Make sure SCCP and ConstantFolding agree on undef >> a.
Currently SCCP folds the value to -1, while ConstantProp folds to
0. This changes SCCP to do what ConstantFolding does.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289147 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 22:28:53 +00:00
Simon Atanasyan
b99cfea378 [mips] Make the test case more specific and provide OS component of a triple. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289117 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 22:10:52 +00:00
Simon Atanasyan
8133f26e49 [mips] Change instruction s/daddiu/addiu/ since O32 prohibits the use of 64-bit GPRs. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289115 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 22:10:48 +00:00
Simon Atanasyan
f375f74c8a [mips] Change gnueabi to gnu in the triple because EABI has been removed recently. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289114 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 22:10:44 +00:00
Simon Atanasyan
52fccbe647 [mips] Remove N32 Android test because Android does not support N32 ABI. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289113 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 22:10:38 +00:00
Reid Kleckner
477e64915f Don't emit .seh_handler directives for any cleanup funclets
We were falsely claiming that we had an LSDA for the relevant EH
personality before this change, which could lead to the EH machinery
interpreting random adjacent data as an LSDA.

Fixes PR31317

This change is safe because cleanups can't contain exception handlers
today. We do these things to maintain that invariant:
- C++ destructors are naturally out-of-line
- __finally blocks are outlined in clang
- LLVM's inliner will not inline EH constructs into cleanups

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289101 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 20:38:46 +00:00
Krzysztof Parzyszek
73a6d5ba6a [RDF] Fix incorrect lane mask calculation
This was exposed by some code that used more than one level of sub-
registers. There is no testcase, because there is no such code in the
Hexagon backend.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289099 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 20:33:45 +00:00
Sanjay Patel
328a9cb5c6 [InstSimplify] add fdiv x/1.0 test and update checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289098 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 20:23:56 +00:00
Matt Arsenault
beec226db5 AMDGPU: Make f16 ConstantFP legal
Not having this legal led to combine failures, resulting
in dumb things like bitcasts of constants not being folded
away.

The only reason I'm leaving the v_mov_b32 hack that f32
already uses is to avoid madak formation test regressions.
PeepholeOptimizer has an ordering issue where the immediate
fold attempt is into the sgpr->vgpr copy instead of the actual
use. Running it twice avoids that problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289096 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 20:14:46 +00:00
Stanislav Mekhanoshin
00f1f5a961 [AMDGPU] Fix number of reserved SGPRs on CI to reflect flat scratch use
Differential Revision: https://reviews.llvm.org/D27225

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289095 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 20:07:23 +00:00
Matt Arsenault
545a46b9c2 AMDGPU: Fix commuting v_sub_u16
The correct commutable opcode was set to itself, so this
was simply swapping the operands to commute instead of also
changing the opcode to v_subrev_u16.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289093 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 19:52:38 +00:00
Stanislav Mekhanoshin
fcb33c493a [AMDGPU] Add amdgpu-unify-metadata pass
Multiple metadata values for records such as opencl.ocl.version, llvm.ident
and similar are created after linking several modules. For some of them, notably
opencl.ocl.version, this creates semantic problem because we cannot tell which
version of OpenCL the composite module conforms.

Moreover, such repetitions of identical values often create a huge list of
unneeded metadata, which grows bitcode size both in memory and stored on disk.
It can go up to several Mb when linked against our OpenCL library. Lastly, such
long lists obscure reading of dumped IR.

The pass unifies metadata after linking.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289092 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 19:46:04 +00:00
Peter Collingbourne
b29976c54b IR, X86: Understand !absolute_symbol metadata on global variables.
Summary:
Attaching !absolute_symbol to a global variable does two things:
1) Marks it as an absolute symbol reference.
2) Specifies the value range of that symbol's address.
Teach the X86 backend to allow absolute symbols to appear in place of
immediates by extending the relocImm and mov64imm32 matchers. Start using
relocImm in more places where it is legal.

As previously proposed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2016-October/105800.html

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289087 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 19:01:00 +00:00
Chris Bieneman
4d6c7e915f [ObjectYAML] Remove DWARF from class names
Since all the DWARF classes are in a DWARFYAML namespace having every class start with DWARF seems like a bit of overkill.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289080 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 17:46:57 +00:00
Alexander Timofeev
9ae2b48b84 [AMDGPU] Scalarization of global uniform loads.
Summary:
LC can currently select scalar load for uniform memory access
basing on readonly memory address space only. This restriction
originated from the fact that in HW prior to VI vector and scalar caches
are not coherent. With MemoryDependenceAnalysis we can check that the
memory location corresponding to the memory operand of the LOAD is not
clobbered along the all paths from the function entry.

Reviewers: rampitec, tstellarAMD, arsenm

Subscribers: wdng, arsenm, nhaehnle

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289076 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 17:28:47 +00:00
Keno Fischer
83dc06334f ConstantFolding: Don't crash when encountering vector GEP
ConstantFolding tried to cast one of the scalar indices to a vector
type. Instead, use the vector type only for the first index (which
is the only one allowed to be a vector) and use its scalar type
otherwise.

Fixes PR31250.

Reviewers: majnemer
Differential Revision: https://reviews.llvm.org/D27389

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289073 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 17:22:35 +00:00
Greg Clayton
23e3fe93ac Fix ASAN buildbots by fixing a double free crash.
The dwarfgen::Generator::StringPool was in a unique_ptr but it was owned by the Allocator member variable so it was being free twice.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289070 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 16:57:04 +00:00
NAKAMURA Takumi
c3e85bfe21 Prune unused libdeps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289060 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 15:28:02 +00:00
NAKAMURA Takumi
806f05a329 Prune unused \param(s) in r289050. [-Wdocumentation]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289057 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 15:00:12 +00:00
NAKAMURA Takumi
80b77c985a DIE::addAttribute(): Prune a redundant \param. [-Wdocumentation]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289056 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 15:00:07 +00:00
NAKAMURA Takumi
396a349428 LanaiInstPrinter: Prune unused libdeps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289054 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 14:26:30 +00:00
NAKAMURA Takumi
a4cbaecf6e DebugInfoDWARFTests: Prune unused libdeps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289053 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 14:26:23 +00:00
NAKAMURA Takumi
8f6644264b DebugInfoDWARFTests: Add missing deps, AsmPrinter and Object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289052 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 14:11:02 +00:00
NAKAMURA Takumi
9dd9fc44cb DebugInfoDWARFTests: Reorder LLVM_LINK_COMPONENTS.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289051 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 14:10:57 +00:00
Nicolai Haehnle
616da7e4f4 [SelectionDAG] Add expansion and promotion of [US]MUL_LOHI
Summary:
Most targets set the action for these nodes to Expand even though there
isn't actually any code for them in ExpandNode. Instead, targets simply
relied on the fact that no code generates these nodes as long as the
nodes aren't legal or custom.

However, generating these nodes can be useful e.g. for divide-by-constant
in wider integer types.

Expand of [US]MUL_LOHI will use MULH[US] when legal or custom, and
a sequence of half-width multiplications otherwise. Promote uses a wider
multiply.

This patch intends to not change the generated code, but indirect effects
are possible since expansions/promotions that were previously done in
DAGCombine may now be done in LegalizeDAG.

See D24822 for a change that actually uses the new expansion.

Reviewers: spatel, bkramer, venkatra, efriedma, hfinkel, ast, nadav, tstellarAMD

Subscribers: arsenm, jyknight, nemanjai, wdng, nhaehnle, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289050 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 14:08:14 +00:00
Nicolai Haehnle
09d35d93b1 X86: Add checks for fma_patterns[_wide].ll with -enable-no-infs-fp-math
This re-adds checks for the patterns that were disabled with r288506.

Reviewers: spatel, delena, craig.topper

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289049 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 14:08:08 +00:00
Nicolai Haehnle
e299df1799 AMDGPU: Properly implement SIRegisterInfo::isFrameOffsetLegal and needsFrameBaseReg
Summary:
Without the fix to isFrameOffsetLegal to consider the instruction's
immediate offset, the new test case hits the corresponding assertion in
resolveFrameIndex, because the LocalStackSlotAllocation pass re-uses a
different base register.

With only the fix to isFrameOffsetLegal, code quality reduces in a bunch of
places because frame base registers are added where they're not needed.
This is addressed by properly implementing needsFrameBaseReg, which also
helps to avoid unnecessary zero frame indices in a bunch of other places.

Fixes piglit glsl-1.50/execution/variable-indexing/gs-output-array-vec4-index-wr.shader_test

Reviewers: arsenm, tstellarAMD

Subscribers: qcolombet, kzhuravl, wdng, yaxunl, tony-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289048 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 14:08:02 +00:00
Daniel Jasper
51d83c3344 Move DwarfGenerator.cpp to unittests
So far it creates a test helper and so it should be moved there. It also
create a layering cycle between CodeGen and CodeGen/AsmPrinter, which
should be avoided.

Review: https://reviews.llvm.org/D27570

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289044 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 12:45:29 +00:00
Alexey Bataev
fb32ef497d [SLP] Fix for PR6246: vectorization for scalar ops on vector elements.
When trying to vectorize trees that start at insertelement instructions
function tryToVectorizeList() uses vectorization factor calculated as
MinVecRegSize/ScalarTypeSize. But sometimes it does not work as tree
cost for this fixed vectorization factor is too high.
Patch tries to improve the situation. It tries different vectorization
factors from max(PowerOf2Floor(NumberOfVectorizedValues),
MinVecRegSize/ScalarTypeSize) to MinVecRegSize/ScalarTypeSize and tries
to choose the best one.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289043 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 11:57:51 +00:00
Pavel Labath
f91385ca90 Fix MSCV compilation broken by r289040
I wanted to use the "not" keyword to make sure it does not get lost in between
other checks. MSVC does not like that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289041 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 11:45:38 +00:00
Pavel Labath
d11d167713 Improve format member detection in llvm::formatv
Summary:
The existing detection of a format member function has a couple of deficiencies:
- the member function does not get detected if one calls formatv with an lvalue,
  because the template parameter gets deduced as T&, which fails the is_class
  check.
- it also did not work if the function was called with a const variable because
  the template parameter would get deduced as const T&, again failing the
  is_class check.

This fixes the problem by stripping the references in the uses_format_member
template, to make sure the type is correctly detected as class. It also provides
specializations of the has_FormatMember template for const and non-const members
of the types in order to enable declaring the format member as a "const"
function. I have added tests that verify that formatv can be now called in these
scenarios. As some scenarios could not be verified at runtime (e.g. making sure
that calling a non-const format member on a const object does *not* compile), I
have also added some static_asserts which test the behaviour of the template
classes used internally by formatv().

Reviewers: zturner

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289040 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 11:31:19 +00:00
Dylan McKay
8f6ef5fefd [AVR] Add MIR tests for pseudo instruction expansions
This adds tests for 13 pseudo instruction expansions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289039 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 10:52:13 +00:00
Simon Pilgrim
bbc30ffcb6 Wdocumentation fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289038 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 10:41:41 +00:00