36630 Commits

Author SHA1 Message Date
Andrey Turetskiy
7e9b79653d [X86] Enable RRL part of the LEA optimization pass for -O2.
Enable "Remove Redundant LEAs" part of the LEA optimization pass for -O2.
This gives 6.4% performance improve on Broadwell on nnet benchmark from Coremark-pro.
There is no significant effect on other benchmarks (Geekbench, Spec2000, Spec2006).

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270036 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19 10:18:29 +00:00
Zlatko Buljan
f68477089e [mips][microMIPS] Implement BC1EQZC, BC1NEZC, BC2EQZC and BC2NEZC instructions
Differential Revision: http://reviews.llvm.org/D18352


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270030 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19 07:31:28 +00:00
Peter Collingbourne
28f667b461 CodeGen: Make the global-merge pass independently testable, and add a test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270023 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19 04:38:56 +00:00
Sanjoy Das
658bddf628 [GuardWidening] Use getEquivalentICmp to fold constant compares
`ConstantRange::getEquivalentICmp` is more general, and better
factored.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270019 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19 03:53:17 +00:00
Dan Gohman
783e35acb8 [WebAssembly] Make several CHECK lines less fragile using regexes and CHECK-DAG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270011 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19 01:52:56 +00:00
Matt Arsenault
44aaff08ed AMDGPU: Fix promote alloca for pointer loads
If the load has a pointer type, we don't want to change
its type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270000 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 23:20:24 +00:00
Sanjoy Das
0266d5e92a New pass: guard widening
Summary:
Implement guard widening in LLVM. Description from GuardWidening.cpp:

The semantics of the `@llvm.experimental.guard` intrinsic lets LLVM
transform it so that it fails more often that it did before the
transform.  This optimization is called "widening" and can be used hoist
and common runtime checks in situations like these:

```
%cmp0 = 7 u< Length
call @llvm.experimental.guard(i1 %cmp0) [ "deopt"(...) ]
call @unknown_side_effects()
%cmp1 = 9 u< Length
call @llvm.experimental.guard(i1 %cmp1) [ "deopt"(...) ]
...
```

to

```
%cmp0 = 9 u< Length
call @llvm.experimental.guard(i1 %cmp0) [ "deopt"(...) ]
call @unknown_side_effects()
...
```

If `%cmp0` is false, `@llvm.experimental.guard` will "deoptimize" back
to a generic implementation of the same function, which will have the
correct semantics from that point onward.  It is always _legal_ to
deoptimize (so replacing `%cmp0` with false is "correct"), though it may
not always be profitable to do so.

NB! This pass is a work in progress.  It hasn't been tuned to be
"production ready" yet.  It is known to have quadriatic running time and
will not scale to large numbers of guards

Reviewers: reames, atrick, bogner, apilipenko, nlewycky

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269997 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 22:55:34 +00:00
Dehao Chen
8458fdbf49 Follow-up patch of http://reviews.llvm.org/D19948 to handle missing profiles when simplifying CFG.
Summary: Set default branch weight to 1:1 if one of the branch has profile missing when simplifying CFG.

Reviewers: spatel, davidxl

Subscribers: danielcdh, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269995 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 22:41:03 +00:00
Rafael Espindola
ac8db59598 Delete Reloc::Default.
Having an enum member named Default is quite confusing: Is it distinct
from the others?

This patch removes that member and instead uses Optional<Reloc> in
places where we have a user input that still hasn't been maped to the
default value, which is now clear has no be one of the remaining 3
options.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269988 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 22:04:49 +00:00
Michael Zolotukhin
6e6d60d000 [LoopUnrollAnalyzer] Take into account cost of instructions controlling branches, along with their operands.
Previously, we didn't add their and their operands cost, which could've
resulted in unrolling loops for no actual benefit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269985 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 21:20:12 +00:00
Sanjay Patel
23cb114e0e [x86] add test for immediate comment formatting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269977 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 20:26:32 +00:00
Chris Bieneman
346e51ed36 Fixing test failure on Windows bot
http://bb.pgr.jp/builders/msbuild-llvmclang-x64-msc19-DA/builds/553/steps/test-llvm/logs/LLVM%20%3A%3A%20ObjectYAML__MachO__load_commands.yaml

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269975 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 20:01:48 +00:00
Krzysztof Parzyszek
fa30381518 When looking for a spill slot in reg scavenger, find one that matches RC
When looking for an available spill slot, the register scavenger would stop
after finding the first one with no register assigned to it. That slot may
have size and alignment that do not meet the requirements of the register
that is to be spilled. Instead, find an available slot that is the closest
in size and alignment to one that is needed to spill a register from RC.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269969 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 18:16:00 +00:00
Simon Pilgrim
75211621d1 [X86][SSE2] Added fast-isel tests to sync with clang/test/CodeGen/sse2-builtins.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269966 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 18:00:43 +00:00
Rui Ueyama
17e3d064b5 pdbdump: Print out section offsets in the publics stream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269955 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 16:24:16 +00:00
Chris Bieneman
7ec0ea16b7 Re-apply: [obj2yaml] [yaml2obj] Support MachO section and section_64
This re-applies r269845, r269846, and r269850 with an included fix for a crash reported by zturner.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269953 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 16:17:23 +00:00
Matt Arsenault
3cd52aec7c AMDGPU: Other sizes of popcnt are fast
We can chain bcnt instructions together, so
any width popcnt is pretty fast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269950 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 16:10:19 +00:00
Hans Wennborg
a9355d3c68 Re-commit r269828 "X86: Avoid using _chkstk when lowering WIN_ALLOCA instructions"
with an additional fix to make RegAllocFast ignore undef physreg uses. It would
previously get confused about the "push %eax" instruction's use of eax. That
method for adjusting the stack pointer is used in X86FrameLowering::emitSPUpdate
as well, but since that runs after register-allocation, we didn't run into the
RegAllocFast issue before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269949 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 16:10:17 +00:00
Matt Arsenault
5d9f8fb9d4 AMDGPU: Fix assert when erroring on a call
For some reason an assert is now hit when a valid chain
is not returned, so return the entry chain.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269948 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 16:10:11 +00:00
Matt Arsenault
41cf920df5 AMDGPU: Handle alloca promoting with null operands
If the second pointer in a multi-pointer instruction is
a constant, we can replace the type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269945 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 15:57:21 +00:00
Matt Arsenault
c33f9cd287 AMDGPU: Fix a few slightly broken tests
Fix minor bugs and uses of undef which break when
pointer related optimization passes are run.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269944 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 15:48:44 +00:00
Davide Italiano
d77d4c07fb [PM] Port per-function SCCP to the new pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269937 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 15:18:25 +00:00
Krzysztof Parzyszek
8b8fb6b298 [Hexagon] Recognize "q" and "v" in inline-asm as register constraints
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269933 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 14:34:51 +00:00
Dan Gohman
da38a6d070 [WebAssembly] Don't expand divisions by constants.
Don't expand divisions by constants if it would require multiple instructions.
The current assumption is that engines will perform the desired optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269930 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 14:29:42 +00:00
Simon Pilgrim
7cea10a7cf [X86][SSE42] Added fast-isel tests to sync with clang/test/CodeGen/sse42-builtins.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269929 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 14:28:54 +00:00
Simon Pilgrim
d6f9ab1e40 [X86][SSE41] Sync with clang/test/CodeGen/sse41-builtins.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269925 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 13:46:10 +00:00
Bryan Chan
5137cfa191 [SystemZ] Fix register ordering for BinaryRRF instructions
Summary:
The ordering of registers in BinaryRRF instructions are wrong, and
affects the copysign instruction (CPSDR). This results in the wrong
magnitude and sign being set.

Author: zhanjunl

Reviewers: kbarton, uweigand

Subscribers: llvm-commits

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269922 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 13:24:57 +00:00
Simon Pilgrim
ddbf9200f0 [X86][SSE3] Sync with clang/test/CodeGen/sse3-builtins.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269920 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 13:16:31 +00:00
Ashutosh Nema
1db659ede4 Add new flag and intrinsic support for MWAITX and MONITORX instructions
Summary:

MONITORX/MWAITX instructions provide similar capability to the MONITOR/MWAIT
pair while adding a timer function, such that another termination of the MWAITX
instruction occurs when the timer expires. The presence of the MONITORX and
MWAITX instructions is indicated by CPUID 8000_0001, ECX, bit 29.

The MONITORX and MWAITX instructions are intercepted by the same bits that
intercept MONITOR and MWAIT. MONITORX instruction establishes a range to be
monitored. MWAITX instruction causes the processor to stop instruction execution
and enter an implementation-dependent optimized state until occurrence of a
class of events.

Opcode of MONITORX instruction is "0F 01 FA". Opcode of MWAITX instruction is
"0F 01 FB". These opcode information is used in adding tests for the
disassembler.

These instructions are enabled for AMD's bdver4 architecture.

Patch by Ganesh Gopalasubramanian!

Reviewers: echristo, craig.topper, RKSimon
Subscribers: RKSimon, joker.eph, llvm-commits
Differential Revision: http://reviews.llvm.org/D19795


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269911 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 11:59:12 +00:00
Rafael Espindola
2dc637165b Don't pass a Reloc::Model to MC.
MC only needs to know if the output is PIC or not. It never has to
decide about creating GOTs and PLTs for example. The only thing that
MC itself uses this information for is expanding "macros" in sparc and
mips. The rest I am pretty sure could be moved to CodeGen.

This is a cleanup and isolates the code from future changes to
Reloc::Model.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269909 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 11:58:50 +00:00
Simon Pilgrim
d097069506 [X86][SSSE3] Sync with clang/test/CodeGen/ssse3-builtins.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269903 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 11:19:17 +00:00
Simon Pilgrim
adac53f19e [X86][SSE4A] Sync with clang/test/CodeGen/sse4a-builtins.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269902 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 11:14:58 +00:00
Simon Dardis
79149b9fae [mips] Restrict the creation of compact branches
Restrict the creation of compact branches so that they meet the ISA encoding
requirements. Notably do not permit $zero to be used as a operand for compact
branches and ensure that some other branches fulfil the requirement that
rs != rt.

Fixup cases where $rs > $rt for bnec and beqc.

Reviewers: dsanders, vkalintiris

Differential Review: http://reviews.llvm.org/D20284


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269893 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 09:21:44 +00:00
Chris Dewhurst
06dac21852 [Sparc] Add Soft Float support
This change adds support for software floating point operations for Sparc targets.

This is the first in a set of patches to enable software floating point on Sparc. The next patch will enable the option to be used with Clang.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269892 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 09:14:13 +00:00
Igor Kudrin
24466cded7 [Coverage] Ensure that coverage mapping data has an expected alignment in 'covmapping' files.
Coverage mapping data is organized in a sequence of blocks, each of which is expected
to be aligned by 8 bytes. This feature is used when reading those blocks, see
VersionedCovMapFuncRecordReader::readFunctionRecords(). If a misaligned covearge
mapping data has more than one block, it causes llvm-cov to fail.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269887 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 07:43:27 +00:00
Zlatko Buljan
4b34e977df [mips][microMIPS] Implement LH, LHE, LHU and LHUE instructions and add CodeGen support
Differential Revision: http://reviews.llvm.org/D15418


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269883 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 06:54:59 +00:00
Rafael Espindola
214e8d3f06 Don't pass relocation-model= to tests that don't need it.
Very few things in MC itself use the option. Most of the code that that
uses it could be move to CodeGen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269871 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 00:27:17 +00:00
Zachary Turner
8e5ffc9803 Revert "[obj2yaml] [yaml2obj] Support MachO section and section_64
structs"

This reverts commits r269845, r269846, and r269850 as they
introduce a crash in obj2yaml when trying to do a roundtrip.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269865 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 23:38:22 +00:00
Dan Gohman
51510adcfa [WebAssembly] Rename $discard to $drop in the assembly output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269862 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 23:19:03 +00:00
Rui Ueyama
dce33b5457 pdbdump: Print out more strcutures.
I don't yet fully understand the meaning of these data strcutures,
but at least it seems that their sizes and types are correct.
With this change, we can read publics streams till end.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269861 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 23:07:48 +00:00
Dan Gohman
b9fa981c8a [WebAssembly] Model the stack evaluation order more precisely.
We currently don't represent get_local and set_local explicitly; they
are just implied by virtual register use and def. This avoids a lot of
clutter, but it does complicate stackifying: get_locals read their
operands at their position in the stack evaluation order, rather than
at their parent instruction. This patch adds code to walk the stack to
determine the precise ordering, when needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269854 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 22:24:18 +00:00
David Blaikie
7fdce00ff3 llvm-dwp: Add error handling for multiple type sections in a dwp file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269851 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 22:00:57 +00:00
Chris Bieneman
d640f9183d Fixing a test case that I broke by fixing r269846
This should fix the bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269850 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 21:55:45 +00:00
Justin Bogner
9c81a3f598 [PM] Port DSE to the new pass manager
Patch by JakeVanAdrighem. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269847 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 21:38:13 +00:00
Chris Bieneman
b04144c7d6 [obj2yaml] [yaml2obj] Support MachO section and section_64 structs
This patch adds round trip support for MachO section structs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269845 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 21:31:02 +00:00
Dan Gohman
e5abbb2bf0 [WebAssembly] Don't stackify calls past stack pointer modifications.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269843 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 21:14:26 +00:00
Hans Wennborg
fc99ce0062 Revert r269828 "X86: Avoid using _chkstk when lowering WIN_ALLOCA instructions"
Seems to have broken the Windows ASan bot. Reverting while investigating.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269833 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 20:38:56 +00:00
Sanjay Patel
e448e72356 [InstCombine] add another test for wrong icmp constant (PR27792)
It doesn't matter if the comparison is unsigned; the inc/dec is always signed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269831 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 20:20:40 +00:00
Dan Gohman
f9336ec145 [WebAssembly] Stackify induction variable increment instructions.
This handles instructions where the defined register is also used, as in
"x = x + 1".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269830 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 20:19:47 +00:00
Hans Wennborg
547f114e33 X86: Avoid using _chkstk when lowering WIN_ALLOCA instructions
This patch moves the expansion of WIN_ALLOCA pseudo-instructions
into a separate pass that walks the CFG and lowers the instructions
based on a conservative estimate of the offset between the stack
pointer and the lowest accessed stack address.

The goal is to reduce binary size and run-time costs by removing
calls to _chkstk. While it doesn't fix all the code quality problems
with inalloca calls, it's an incremental improvement for PR27076.

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

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