132168 Commits

Author SHA1 Message Date
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
9dbb32236a [LowerGuards] Rename variable; NFC
PredicatePassProbability is a better name for what LikelyBranchWeight
was trying to express.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269999 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 23:16:27 +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
Haicheng Wu
7a03ff405d [MBP] Remove a redundant skipFunction(). NFC.
skipFunction() is called twice.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269994 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 22:34:45 +00:00
Richard Smith
cf44b366f9 Work around a glibc bug: backtrace() spuriously fails if
- glibc is dynamically linked, and
 - libgcc_s is unavailable (for instance, another library is being used to
   provide the compiler runtime or libgcc is statically linked), and
 - the target is x86_64.

If we run backtrace() and it fails to find any stack frames, try using
_Unwind_Backtrace instead if available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269992 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 22:26:36 +00:00
Sanjay Patel
7aae44e690 fix formatting; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269990 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 22:05:28 +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
Jacques Pienaar
57380a7dcf [lanai] Change the way flag setting instructions are checked.
isReturn() was returning different values with and without -g which led to
different code being generated. Change isFlagSettingInstruction to query
an instruction's effect on SR instead.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269986 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 21:31:37 +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
Dan Gohman
b3b1972f26 [WebAssembly] Disable the MachineScheduler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269976 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 20:19:02 +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
Dehao Chen
279b28ea43 clang-format SimplifyCFG.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269974 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 19:44:21 +00:00
Jan Vesely
c8ee6f35bc AMDGPU: Fix incorrect simm check
Use signed division otherwise all back jumps fail the check
Fixes regression introduced in r269951

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269972 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 19:07:58 +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
Chad Rosier
de2a437afc [AArch64] Minor refactoring. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269963 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 17:43:11 +00:00
Sanjay Patel
7d1364e974 clean up; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269962 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 17:23:38 +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
Rafael Espindola
bbc289f36c Delete dead code. Reloc::Default is the default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269954 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 16:19:20 +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
76e32dfbc0 AMDGPU: Error if branch distance exceeds limit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269951 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 16:10:24 +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
Rafael Espindola
c023b23341 Trivial cleanups.
This just clang formats and cleans comments in an area I am about to
post a patch for review.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269946 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 16:00:24 +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
Matt Arsenault
39107ccf80 AMDGPU: Don't run passes that aren't useful
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269943 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 15:41:07 +00:00
Matt Arsenault
71a492ec1e AMDGPU: Fix assert on ttmp registers
Use register class that does not include them when looking
for unallocated registers.

This is hit by the udiv v8i64 test in the opencl integer
conformance test, and takes a few seconds to compile in
a debug build so no test included.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269938 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 15:19:50 +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
Rafael Espindola
ae88dc47a7 White space cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269919 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 13:10:27 +00:00
Aaron Ballman
3b69c0e412 Removing an unused variable introduced in r269911; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269915 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 12:52:04 +00:00
Daniel Sanders
8d706cc7df Try again to fix pdbdump-headers.test on big-endian hosts after r269861.
r269898 fixed the problem with HashBuckets but the same issue occurred with
AddressMap and ThunkMap too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269913 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 12:36:25 +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
James Molloy
9c1a0c965c [VectorUtils] Fix nasty use-after-free
In truncateToMinimalBitwidths() we were RAUW'ing an instruction then erasing it. However, that intruction could be cached in the map we're iterating over. The first check is "I->use_empty()" which in most cases would return true, as the (deleted) object was RAUW'd first so would have zero use count. However in some cases the object could have been polluted or written over and this wouldn't be the case. Also it makes valgrind, asan and traditionalists who don't like their compiler to crash sad.

No testcase as there are no externally visible symptoms apart from a crash if the stars align.

Fixes PR26509.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269908 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 11:57:58 +00:00
Dylan McKay
f313ca4a81 [AVR] Remove the 'AVRConfig.h' header
It defined the LLVM_AVR_GCC_COMPAT constant, which would enable/disable
certain GCC-specific behaviours.

There is no point conditionally turning it on/off, as it will always be
turned on, and we have to maintain both code paths anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269904 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 11:20:48 +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
Dylan McKay
ea9e0d46c4 [AVR] Add missing CMake dependencies
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269901 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 11:11:51 +00:00
Dylan McKay
af292693ca [AVR] Fix a few compile errors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269900 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 11:11:38 +00:00
Simon Dardis
2366631516 [PATCH] [mips] Restrict the creation of compact branches
Restrict the creation of compact branches so that they do meet the ISA
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.

Recommit of rL269893 with reviewers comments.

Reviewers: dsanders, vkalintiris

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269899 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 10:38:01 +00:00