Commit Graph

41254 Commits

Author SHA1 Message Date
Craig Topper
4c603b39c6 [X86] Add masked versions of VPERMT2* and VPERMI2* to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289186 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 05:20:11 +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
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
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
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
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
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
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
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
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
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
4f38f405fc [X86][SSE] Add vector test for (shl (or x, c1), c2) -> (or (shl x, c2), c1 << c2) detailed in D19325
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289035 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 10:17:25 +00:00
Dylan McKay
119507f5af [AVR] Add MIR tests for a few pseudo instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289031 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 08:54:41 +00:00
Peter Collingbourne
8bb25c4bc6 LTO: Hash the parts of the LTO configuration that affect code generation.
Most importantly, we need to hash the relocation model, otherwise we can
end up trying to link non-PIC object files into PIEs or DSOs.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289024 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 05:28:30 +00:00
Keno Fischer
3f98c183ca Revert "[CodeGen] Fix invalid DWARF info on Win64"
Appears to break on build bots. Reverting pending investigation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289014 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 01:56:23 +00:00
Keno Fischer
94c20c0a62 [CodeGen] Fix invalid DWARF info on Win64
The relocations for `DIEEntry::EmitValue` were wrong for Win64
(emitting FK_Data_4 instead of FK_SecRel_4). This corrects that
oversight so that the DWARF data is correct in Win64 COFF files.

Fixes PR15393.

Patch by Jameson Nash <jameson@juliacomputing.com> based on a patch
by David Majnemer.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289013 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 01:40:21 +00:00
Evgeniy Stepanov
d7bfb58bc1 CFI-icall on Thumb
Replace @progbits in the section directive with %progbits, because "@" starts a comment on arm/thumb.
Use b.w branch instruction.
Use .thumb_function and .thumb_set for proper arm/thumb interwork. This way jumptable entry addresses on thumb have bit 0 set (correctly). This does not affect CFI check math, because the address of the jumptable start also has that bit set.

This does not work on thumbv5, because it does not support b.w, and the linker would not insert a veneer (trampoline?) to extend the range of b.n. We may need to do full-range plt-style jumptables on thumbv54, which are 12 bytes per entry. Another option is "push lr; bl; pop pc" (4 bytes) but that needs unwinding instructions, etc.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289008 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 00:32:26 +00:00
Matthias Braun
94e65047a3 The few days mentioned in r267095 are over
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289004 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 00:16:42 +00:00
Quentin Colombet
aff0caeac1 [InlineSpiller] Don't call TargetInstrInfo::foldMemoryOperand with an empty list.
Since r287792 if we try to do that we will hit an assert.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289001 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 00:06:51 +00:00
Filipe Cabecinhas
8302e1c946 [asan] Split load and store checks in test. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288991 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 22:37:11 +00:00
Davide Italiano
4e51983ffa [BDCE] Skip metadata while replacing uses.
The fix committed in r288851 doesn't cover all the cases.
In particular, if we have an instruction with side effects
which has a no non-dbg use not depending on the bits, we still
perform RAUW destroying the dbg.value's first argument.
Prevent metadata from being replaced here to avoid the issue.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288987 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 21:47:32 +00:00
Tim Northover
4f7586098b GlobalISel: use correct builder for ConstantExprs.
ConstantExpr instances were emitting code into the current block rather than
the entry block. This meant they didn't necessarily dominate all uses, which is
clearly wrong.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288985 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 21:29:15 +00:00
Chris Bieneman
c19200ceed [ObjectYAML] Rename DWARF entries to match section names
This change makes the yaml tags for the members of the DWARF data match the names of the DWARF sections.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288981 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 21:09:37 +00:00
Tim Northover
06bfcf3df9 GlobalISel: simplify MachineIRBuilder interface.
MachineIRBuilder had weird before/after and beginning/end flags for the insert
point. Unfortunately the non-default means that instructions will be inserted
in reverse order which is almost never what anyone wants.

Really, I think we just want (like IRBuilder has) the ability to insert at any
C++ iterator-style point (i.e. before any instruction or before MBB.end()). So
this fixes MIRBuilders to behave like IRBuilders in this respect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288980 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 21:05:38 +00:00
Matt Arsenault
98b1edd6bb InstCombine: Fold bitcast of vector to FP scalar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288978 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 20:56:11 +00:00
Eli Friedman
b60c7b1f61 [GVNHoist] Invalidate MemDep when an instruction is moved.
See also r279907.

Fixes https://llvm.org/bugs/show_bug.cgi?id=30991 .

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288968 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 19:55:59 +00:00
Michael Kuperstein
30fb413876 [X86] Skip over DEBUG_VALUE while looking for start of call sequence
If we don't skip over DEBUG_VALUEs, we get differences between -g and non-g
code.

This fixes PR31242.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288965 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 19:31:08 +00:00
Michael Kuperstein
3ffda498ec [X86] Do not assume "ri" instructions always have an immediate operand
The second operand of an "ri" instruction may be an immediate, but it may
also be a globalvariable, so we should make any assumptions.

This fixes PR31271.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288964 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 19:29:18 +00:00
Sanjay Patel
8b90b13aa1 [InstCombine] add tests for smin+icmp; NFC
The tests that already work are folded in InstSimplify, so those
tests should be redundant and we can remove them if they don't
seem worthwhile for completeness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288957 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 18:56:55 +00:00
Chris Bieneman
cf24fcb20a [ObjectYAML] Support for DWARF __debug_abbrev section
This patch adds support for round-tripping DWARF debug abbreviations through the obj<->yaml tools.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288955 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 18:52:59 +00:00
Simon Pilgrim
aee7c6e2f5 [SelectionDAG] Add knownbits support for vector demandedelts in SMAX/SMIN/UMAX/UMIN opcodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288926 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 17:54:00 +00:00