oota-llvm.git
8 years ago[PGO] Introduce value profile data closure type.
Xinliang David Li [Tue, 24 Nov 2015 19:21:15 +0000 (19:21 +0000)]
[PGO] Introduce value profile data closure type.

The closure is designed to abstact away two types of value profile
data:
  - InstrProfRecord which is the primary data structure used to
    represent profile data in host tools (reader, writer, and profile-use)
  - value profile runtime data structure suitable to be used by C
    runtime library.
Both sources of data need to serialize to disk/memory-buffer in common
format: ValueProfData.

The abstraction allows compiler-rt's raw profiler writer to share
the same code with indexed profile writer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254008 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Utils] Put includes in correct order. NFC.
Weiming Zhao [Tue, 24 Nov 2015 18:57:06 +0000 (18:57 +0000)]
[Utils] Put includes in correct order. NFC.

Summary:
    Followed the guidelines in:
    http://llvm.org/docs/CodingStandards.html#include-style

    However, I noticed that uppercase named headers come before lowercase ones
    throughout the codebase. So kept them as is.

    Patch by Mandeep Singh Grang <mgrang@codeaurora.org>

Reviewers: majnemer, davide, jmolloy, atrick

Subscribers: sanjoy

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254005 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PGO] Small interface change to be profile rt ready
Xinliang David Li [Tue, 24 Nov 2015 18:15:46 +0000 (18:15 +0000)]
[PGO] Small interface change to be profile rt ready

Convert two C++ static member functions to be C APIs. This
is one of the many steps to get ready to share VP writer code
with profiler runtime.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253999 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[InstCombine] fix propagation of fast-math-flags
Sanjay Patel [Tue, 24 Nov 2015 17:51:20 +0000 (17:51 +0000)]
[InstCombine] fix propagation of fast-math-flags

Noticed while working on D4583:
http://reviews.llvm.org/D4583

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253997 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agouse convenience function for copying IR flags; NFCI
Sanjay Patel [Tue, 24 Nov 2015 17:16:33 +0000 (17:16 +0000)]
use convenience function for copying IR flags; NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253996 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMinor refactor to make VP writing more efficient
Xinliang David Li [Tue, 24 Nov 2015 17:03:24 +0000 (17:03 +0000)]
Minor refactor to make VP writing more efficient

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253994 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMake this test a bit more strict.
Rafael Espindola [Tue, 24 Nov 2015 16:43:53 +0000 (16:43 +0000)]
Make this test a bit more strict.

It now tests with files in both orders.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253993 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd vector types for intrinsics
Krzysztof Parzyszek [Tue, 24 Nov 2015 16:28:14 +0000 (16:28 +0000)]
Add vector types for intrinsics

Author: Ron Lieberman <ronl@codeaurora.org>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253992 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ThinLTO] Fix FunctionImport alias checking and test
Teresa Johnson [Tue, 24 Nov 2015 16:10:43 +0000 (16:10 +0000)]
[ThinLTO] Fix FunctionImport alias checking and test

Skip imports for weak_any aliases as well. Fix the test to check
non-import of weak aliases and functions, and import of normal alias.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253991 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd names for the new vector types in CodeGenTarget.cpp
Krzysztof Parzyszek [Tue, 24 Nov 2015 15:50:22 +0000 (15:50 +0000)]
Add names for the new vector types in CodeGenTarget.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253989 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[x86] remove duplicate movq instruction defs (PR25554)
Sanjay Patel [Tue, 24 Nov 2015 15:44:35 +0000 (15:44 +0000)]
[x86] remove duplicate movq instruction defs (PR25554)

We had duplicated definitions for the same hardware '[v]movq' instructions. For example with SSE:

  def MOVZQI2PQIrr : RS2I<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR64:$src),
                     "mov{d|q}\t{$src, $dst|$dst, $src}", // X86-64 only
                     [(set VR128:$dst, (v2i64 (X86vzmovl (v2i64 (scalar_to_vector GR64:$src)))))],
                     IIC_SSE_MOVDQ>;

  def MOV64toPQIrr : RS2I<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR64:$src),
                     "mov{d|q}\t{$src, $dst|$dst, $src}",
                     [(set VR128:$dst, (v2i64 (scalar_to_vector GR64:$src)))],
                     IIC_SSE_MOVDQ>, Sched<[WriteMove]>;

As shown in the test case and PR25554:
https://llvm.org/bugs/show_bug.cgi?id=25554

This causes us to miss reusing an operand because later passes don't know these 'movq' are the same instruction.
This patch deletes one pair of these defs.
Sadly, this won't fix the original test case in the bug report. Something else is still broken.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253988 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Hexagon] Add missing include of <cctype>
Krzysztof Parzyszek [Tue, 24 Nov 2015 15:11:13 +0000 (15:11 +0000)]
[Hexagon] Add missing include of <cctype>

Lack thereof breaks Windows builds due to the use of std::isspace
in HexagonInstrInfo.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253987 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Hexagon] Bring HexagonInstrInfo up to date
Krzysztof Parzyszek [Tue, 24 Nov 2015 14:55:26 +0000 (14:55 +0000)]
[Hexagon] Bring HexagonInstrInfo up to date

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253986 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd an already passing test.
Rafael Espindola [Tue, 24 Nov 2015 14:15:50 +0000 (14:15 +0000)]
Add an already passing test.

This tests that a declaration can resolve to an alias.

I broke this locally while prototyping a change and it looks like a nice
test to have.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253984 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd new vector types for 512-, 1024- and 2048-bit vectors
Krzysztof Parzyszek [Tue, 24 Nov 2015 13:07:35 +0000 (13:07 +0000)]
Add new vector types for 512-, 1024- and 2048-bit vectors

Those types are needed to implement instructions for Hexagon Vector
Extensions (HVX): 16x32, 16x64, 32x16, 32x32, 32x64, 64x8, 64x16,
64x32, 128x8, 128x16, 256x8, 512x1, and 1024x1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253978 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU: Split LDS vector loads
Matt Arsenault [Tue, 24 Nov 2015 12:18:54 +0000 (12:18 +0000)]
AMDGPU: Split LDS vector loads

If properly aligned this could allow using ds_read_b64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253975 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU: Split x8 and x16 vector loads instead of scalarize
Matt Arsenault [Tue, 24 Nov 2015 12:05:03 +0000 (12:05 +0000)]
AMDGPU: Split x8 and x16 vector loads instead of scalarize

The one regression in the builtin tests is in the read2 test which now
(again) has many extra copies, but this should be solved once the pass
is replaced with a DAG combine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253974 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix build after r253954
Ismail Donmez [Tue, 24 Nov 2015 09:48:09 +0000 (09:48 +0000)]
Fix build after r253954

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253969 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix non-PIC build after 253959
Pavel Labath [Tue, 24 Nov 2015 09:46:01 +0000 (09:46 +0000)]
Fix non-PIC build after 253959

CMAKE_EXE_LINKER_FLAGS is a string. Appending a flag using list(APPEND) introduces an extra
semicolon which breaks stuff. Change this to append the value in the same way that everyone else
seems to be doing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253968 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoLet SelectionDAG start to use probability-based interface to add successors.
Cong Hou [Tue, 24 Nov 2015 08:51:23 +0000 (08:51 +0000)]
Let SelectionDAG start to use probability-based interface to add successors.

The patch in http://reviews.llvm.org/D13745 is broken into four parts:

1. New interfaces without functional changes.
2. Use new interfaces in SelectionDAG, while in other passes treat probabilities
as weights.
3. Use new interfaces in all other passes.
4. Remove old interfaces.

This the second patch above. In this patch SelectionDAG starts to use
probability-based interfaces in MBB to add successors but other MC passes are
still using weight-based interfaces. Therefore, we need to maintain correct
weight list in MBB even when probability-based interfaces are used. This is
done by updating weight list in probability-based interfaces by treating the
numerator of probabilities as weights. This change affects many test cases
that check successor weight values. I will update those test cases once this
patch looks good to you.

Differential revision: http://reviews.llvm.org/D14361

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253965 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[TableGen] Use std::remove_if instead of manually coded loops that call erase multipl...
Craig Topper [Tue, 24 Nov 2015 08:20:47 +0000 (08:20 +0000)]
[TableGen] Use std::remove_if instead of manually coded loops that call erase multiple times. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253964 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[TableGen] Use the other version of EnforceVectorEltTypeIs inside the TypeSet version...
Craig Topper [Tue, 24 Nov 2015 08:20:45 +0000 (08:20 +0000)]
[TableGen] Use the other version of EnforceVectorEltTypeIs inside the TypeSet version of EnforceVectorEltTypeIs to reduce duplicated code. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253963 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[TableGen] Fix formatting and use logical OR. NFC
Craig Topper [Tue, 24 Nov 2015 08:20:44 +0000 (08:20 +0000)]
[TableGen] Fix formatting and use logical OR. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253962 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[TableGen] Use std::set_intersection to merge TypeSets. NFC
Craig Topper [Tue, 24 Nov 2015 08:20:42 +0000 (08:20 +0000)]
[TableGen] Use std::set_intersection to merge TypeSets. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253961 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[TableGen] Use SmallVector::assign instead of a resize and replace element.
Craig Topper [Tue, 24 Nov 2015 08:20:41 +0000 (08:20 +0000)]
[TableGen] Use SmallVector::assign instead of a resize and replace element.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253960 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CMake] When disabling PIC, also pass -fno-pie when linking if it is supported.
Chris Bieneman [Tue, 24 Nov 2015 08:04:59 +0000 (08:04 +0000)]
[CMake] When disabling PIC, also pass -fno-pie when linking if it is supported.

Building clang with -fno-pie generates slightly faster code. In my not-very-rigorous testing I saw about a 4% speed up using the clang test-suite sources.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253959 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert change that accidentally snuck into r253955.
Craig Topper [Tue, 24 Nov 2015 06:24:06 +0000 (06:24 +0000)]
Revert change that accidentally snuck into r253955.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253956 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[TableGen] Use array_pod_sort. NFC
Craig Topper [Tue, 24 Nov 2015 06:22:43 +0000 (06:22 +0000)]
[TableGen] Use array_pod_sort. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253955 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd a FunctionImporter helper to perform summary-based cross-module function importing
Mehdi Amini [Tue, 24 Nov 2015 06:07:49 +0000 (06:07 +0000)]
Add a FunctionImporter helper to perform summary-based cross-module function importing

Summary:
This is a helper to perform cross-module import for ThinLTO. Right now
it is importing naively every possible called functions.

Reviewers: tejohnson

Subscribers: dexonsmith, llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253954 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd findFunctionInfoList() accessor to FunctionInfoIndex.
Mehdi Amini [Tue, 24 Nov 2015 06:07:42 +0000 (06:07 +0000)]
Add findFunctionInfoList() accessor to FunctionInfoIndex.

Summary:
This allows to query for a function in the map without creating an
entry, allowing to use a const FunctionInfoIndex.

Reviewers: tejohnson

Subscribers: llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253953 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[X86][SSE] Detect AVG pattern during instruction combine for SSE2/AVX2/AVX512BW.
Cong Hou [Tue, 24 Nov 2015 05:44:19 +0000 (05:44 +0000)]
[X86][SSE] Detect AVG pattern during instruction combine for SSE2/AVX2/AVX512BW.

This patch detects the AVG pattern in vectorized code, which is simply
c = (a + b + 1) / 2, where a, b, and c have the same type which are vectors of
either unsigned i8 or unsigned i16. In the IR, i8/i16 will be promoted to
i32 before any arithmetic operations. The following IR shows such an example:

%1 = zext <N x i8> %a to <N x i32>
%2 = zext <N x i8> %b to <N x i32>
%3 = add nuw nsw <N x i32> %1, <i32 1 x N>
%4 = add nuw nsw <N x i32> %3, %2
%5 = lshr <N x i32> %N, <i32 1 x N>
%6 = trunc <N x i32> %5 to <N x i8>

and with this patch it will be converted to a X86ISD::AVG instruction.

The pattern recognition is done when combining instructions just before type
legalization during instruction selection. We do it here because after type
legalization, it is much more difficult to do pattern recognition based
on many instructions that are doing type conversions. Therefore, for
target-specific instructions (like X86ISD::AVG), we need to take care of type
legalization by ourselves. However, as X86ISD::AVG behaves similarly to
ISD::ADD, I am wondering if there is a way to legalize operands and result
types of X86ISD::AVG together with ISD::ADD. It seems that the current design
doesn't support this idea.

Tests are added for SSE2, AVX2, and AVX512BW and both i8 and i16 types of
variant vector sizes.

Differential revision: http://reviews.llvm.org/D14761

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253952 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[DIE] Make DIE.h NDEBUG conditional-free.
Davide Italiano [Tue, 24 Nov 2015 02:21:43 +0000 (02:21 +0000)]
[DIE] Make DIE.h NDEBUG conditional-free.

Switch dump()/print() method definitions to LLVM_DUMP_METHOD instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253945 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CMake] export_executable_symbols also needs to add -rdynamic to the linker flags...
Chris Bieneman [Tue, 24 Nov 2015 00:58:58 +0000 (00:58 +0000)]
[CMake] export_executable_symbols also needs to add -rdynamic to the linker flags on Darwin

Without -rdynamic LLVM built with LTO fails to pass "check" due to loadable modules failing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253944 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUse make_unique [NFC]
Xinliang David Li [Tue, 24 Nov 2015 00:32:00 +0000 (00:32 +0000)]
Use make_unique [NFC]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253942 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemove trailing space in comments
Xinliang David Li [Tue, 24 Nov 2015 00:31:41 +0000 (00:31 +0000)]
Remove trailing space in comments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253941 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agominimize test case but still show the bug
Sanjay Patel [Tue, 24 Nov 2015 00:11:48 +0000 (00:11 +0000)]
minimize test case but still show the bug

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253940 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoNFC. Fixing my consistently incorrect spelling.
Chris Bieneman [Mon, 23 Nov 2015 23:34:09 +0000 (23:34 +0000)]
NFC. Fixing my consistently incorrect spelling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253936 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoadded comment (using freshly updated update_llc_test_checks.py)
Sanjay Patel [Mon, 23 Nov 2015 23:22:05 +0000 (23:22 +0000)]
added comment (using freshly updated update_llc_test_checks.py)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253935 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[x86] add test to show suboptimal codegen (PR25554)
Sanjay Patel [Mon, 23 Nov 2015 23:18:20 +0000 (23:18 +0000)]
[x86] add test to show suboptimal codegen (PR25554)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253934 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RuntimeDyld] Avoid unused-private-field warning; NFC
Sanjoy Das [Mon, 23 Nov 2015 22:59:36 +0000 (22:59 +0000)]
[RuntimeDyld] Avoid unused-private-field warning; NFC

Fixes the no asserts -Werror,-Wunused-private-field build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253933 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WebAssembly] Don't print the types of memory_size and grow_memory
Dan Gohman [Mon, 23 Nov 2015 22:37:29 +0000 (22:37 +0000)]
[WebAssembly] Don't print the types of memory_size and grow_memory

This matches the current spec, for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253931 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PGO] In llvm-profdata text dump, add comment lines as annotations
Xinliang David Li [Mon, 23 Nov 2015 22:31:22 +0000 (22:31 +0000)]
[PGO] In llvm-profdata text dump, add comment lines as annotations

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253930 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert r253923.
Krzysztof Parzyszek [Mon, 23 Nov 2015 22:19:57 +0000 (22:19 +0000)]
Revert r253923.

Per Eric's request.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253928 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agofindDeadCallerSavedReg needs to pay attention to calling convention
Andy Ayers [Mon, 23 Nov 2015 22:17:44 +0000 (22:17 +0000)]
findDeadCallerSavedReg needs to pay attention to calling convention

Caller saved regs differ between SysV and Win64. Use the tail call available set to scavenge from.

Refactor register info to create new helper to get at tail call GPRs. Added a new test case for windows. Fixed up a number of X64 tests since now RCX is preferred over RDX on SysV.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253927 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WebAssembly] Don't special-case call operand order.
Dan Gohman [Mon, 23 Nov 2015 22:04:06 +0000 (22:04 +0000)]
[WebAssembly] Don't special-case call operand order.

With the '=' suffix now indicating which operands are output operands, it's
no longer as important to distinguish between a call's inputs and its outputs
using operand ordering, so we can go back to printing them in the normal order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253925 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoDon't create implicit comdats.
Rafael Espindola [Mon, 23 Nov 2015 22:01:51 +0000 (22:01 +0000)]
Don't create implicit comdats.

comdats are explicitly represented for some time now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253924 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd new vector types for 512-, 1024- and 2048-bit vectors
Krzysztof Parzyszek [Mon, 23 Nov 2015 22:00:17 +0000 (22:00 +0000)]
Add new vector types for 512-, 1024- and 2048-bit vectors

Those types are needed to implement instructions for Hexagon Vector
Extensions (HVX): 16x32, 16x64, 32x16, 32x32, 32x64, 64x8, 64x16,
64x32, 128x8, 128x16, 256x8, 512x1, and 1024x1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253923 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WebAssembly] Suffix output operands with '='.
Dan Gohman [Mon, 23 Nov 2015 21:55:57 +0000 (21:55 +0000)]
[WebAssembly] Suffix output operands with '='.

This distinguishes input operands from output operands. This is something of
a syntactic experiment to see whether the mild amount of clutter this adds is
outweighed by the extra information it conveys to the reader.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253922 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Support] Add optional argument to SaturatingAdd() and SaturatingMultiply() to indica...
Nathan Slingerland [Mon, 23 Nov 2015 21:54:22 +0000 (21:54 +0000)]
[Support] Add optional argument to SaturatingAdd() and SaturatingMultiply() to indicate that overflow occurred

Summary: Adds the ability for callers to detect when saturation occurred on the result of saturating addition/multiplication.

Reviewers: davidxl, silvas, rsmith

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253921 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RuntimeDyld] Don't allocate unnecessary stub buffer space
Sanjoy Das [Mon, 23 Nov 2015 21:47:51 +0000 (21:47 +0000)]
[RuntimeDyld] Don't allocate unnecessary stub buffer space

Summary:
For relocation types that are known to not require stub functions, there
is no need to allocate extra space for the stub functions.

Reviewers: lhames, reames, maksfb

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253920 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RuntimeDyld] Add bounds checking to SectionEntry::advanceStubOffset
Sanjoy Das [Mon, 23 Nov 2015 21:47:46 +0000 (21:47 +0000)]
[RuntimeDyld] Add bounds checking to SectionEntry::advanceStubOffset

Summary:
Change SectionEntry to keep track of the size of its underlying
allocation, and use that to bounds check advanceStubOffset.

Reviewers: lhames, andrew.w.kaylor, reames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253919 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RuntimeDyld] Add accessors to `SectionEntry`; NFC
Sanjoy Das [Mon, 23 Nov 2015 21:47:41 +0000 (21:47 +0000)]
[RuntimeDyld] Add accessors to `SectionEntry`; NFC

Summary:
Remove naked access to the data members in `SectionEntry` and route
accesses through accessor functions.  This makes it obvious how the
instances of the class are used, and will also facilitate adding bounds
checking to `advanceStubOffset` in a later change.

Reviewers: lhames, loladiro, andrew.w.kaylor

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253918 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMake utils/update_llc_test_checks.py note that the assertions are
James Y Knight [Mon, 23 Nov 2015 21:33:58 +0000 (21:33 +0000)]
Make utils/update_llc_test_checks.py note that the assertions are
autogenerated.

Also update existing test cases which appear to be generated by it and
weren't modified (other than addition of the header) by rerunning it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253917 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WebAssembly] Model the return value of store instructions in wasm.
Dan Gohman [Mon, 23 Nov 2015 21:16:35 +0000 (21:16 +0000)]
[WebAssembly] Model the return value of store instructions in wasm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253916 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LIR] Put includes in correct order. NFC.
Chad Rosier [Mon, 23 Nov 2015 21:09:13 +0000 (21:09 +0000)]
[LIR] Put includes in correct order. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253915 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PGO] Add --text option for llvm-profdata show|merge commands
Xinliang David Li [Mon, 23 Nov 2015 20:47:38 +0000 (20:47 +0000)]
[PGO] Add --text option for llvm-profdata show|merge commands

The new option is similar to the SampleProfile dump option.

- dump raw/indexed format into text profile format
- merge the profile and output into text profile format.

Note that Value Profiling data text format is not yet designed.
That functionality will be added later.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253913 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSamplePGO - Add coverage tracking for samples.
Diego Novillo [Mon, 23 Nov 2015 20:12:21 +0000 (20:12 +0000)]
SamplePGO - Add coverage tracking for samples.

The existing coverage tracker counts the number of records that were used
from the input profile. An alternative view of coverage is to check how
many available samples were applied.

This way, if the profile contains several records with few samples, it
doesn't really matter much that they were not applied. The more
interesting records to apply are the ones that contribute many samples.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253912 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WinEH] Fix a case where GVN could incorrectly PRE a load into an EH pad.
Andrew Kaylor [Mon, 23 Nov 2015 19:51:41 +0000 (19:51 +0000)]
[WinEH] Fix a case where GVN could incorrectly PRE a load into an EH pad.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253908 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WebAssembly] Don't use set_local instructions explicitly.
Dan Gohman [Mon, 23 Nov 2015 19:30:43 +0000 (19:30 +0000)]
[WebAssembly] Don't use set_local instructions explicitly.

The current approach to using get_local and set_local is to use them
implicitly, as register uses and defs. Introduce new copy instructions
which are themselves no-ops except for the get_local and set_local
that they imply, so that we use get_local and set_local consistently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253905 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ThinLTO] Deduplicate function index loading into shared helper (NFC)
Teresa Johnson [Mon, 23 Nov 2015 19:19:11 +0000 (19:19 +0000)]
[ThinLTO] Deduplicate function index loading into shared helper (NFC)

Add a shared helper routine to read the function index from a file
and create/return the function index object. Use it in llvm-link and
llvm-lto.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253903 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WinEH] Fix problem where CodeGenPrepare incorrectly sinks a bitcast into an EH pad.
Andrew Kaylor [Mon, 23 Nov 2015 19:16:15 +0000 (19:16 +0000)]
[WinEH] Fix problem where CodeGenPrepare incorrectly sinks a bitcast into an EH pad.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253902 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WebAssembly] Always print loop end labels
Dan Gohman [Mon, 23 Nov 2015 19:12:37 +0000 (19:12 +0000)]
[WebAssembly] Always print loop end labels

WebAssembly is currently using labels to end scopes, so for example a
loop scope looks like this:

BB0_0:
  loop BB0_1
  ...
BB0_1:

with BB0_0 being the label of the first block not in the loop. This
requires that the label be printed even when it's only reachable via
fallthrough. To arrange this, insert a no-op LOOP_END instruction in
such cases at the end of the loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253901 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PGO] Introduce alignment macro for instr-prof control data(NFC)
Xinliang David Li [Mon, 23 Nov 2015 18:02:59 +0000 (18:02 +0000)]
[PGO] Introduce alignment macro for instr-prof control data(NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253893 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WebAssembly] Remove incomplete MCCodeEmitter bits.
Dan Gohman [Mon, 23 Nov 2015 18:00:04 +0000 (18:00 +0000)]
[WebAssembly] Remove incomplete MCCodeEmitter bits.

These are parts of a separate patch that I accidentally included in r253878.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253892 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemove unused function parameter (NFC)
Teresa Johnson [Mon, 23 Nov 2015 17:42:49 +0000 (17:42 +0000)]
Remove unused function parameter (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253889 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd Windows error code and tidy formatting for system errors.
Paul Robinson [Mon, 23 Nov 2015 17:34:20 +0000 (17:34 +0000)]
Add Windows error code and tidy formatting for system errors.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253888 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix comment not allowed in C90
Xinliang David Li [Mon, 23 Nov 2015 17:05:45 +0000 (17:05 +0000)]
Fix comment not allowed in C90

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253880 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WebAssembly] Emit .param, .result, and .local through MC.
Dan Gohman [Mon, 23 Nov 2015 16:50:18 +0000 (16:50 +0000)]
[WebAssembly] Emit .param, .result, and .local through MC.

This eliminates one of the main remaining uses of EmitRawText.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253878 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSamplePGO - Clear coverage tracking when clearing per-function data.
Diego Novillo [Mon, 23 Nov 2015 16:30:17 +0000 (16:30 +0000)]
SamplePGO - Clear coverage tracking when clearing per-function data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253877 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WebAssembly] Use dominator information to improve BLOCK placement
Dan Gohman [Mon, 23 Nov 2015 16:19:56 +0000 (16:19 +0000)]
[WebAssembly] Use dominator information to improve BLOCK placement

Always starting blocks at the top of their containing loops works, but creates
unnecessarily deep nesting because it makes all blocks in a loop overlap.
Refine the BLOCK placement algorithm to start blocks at nearest common
dominating points instead, which significantly shrinks them and reduces
overlapping.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253876 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[mips] .ent and .end should also set the type and size of the symbol respectively.
Daniel Sanders [Mon, 23 Nov 2015 16:08:03 +0000 (16:08 +0000)]
[mips] .ent and .end should also set the type and size of the symbol respectively.

Reviewers: vkalintiris

Subscribers: llvm-commits, seanbruno, emaste, vkalintiris, dsanders

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253875 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Support] Fix SaturatingMultiply<T>() to be correct (and fast), Re-enable Unit Tests
Nathan Slingerland [Mon, 23 Nov 2015 15:33:43 +0000 (15:33 +0000)]
[Support] Fix SaturatingMultiply<T>() to be correct (and fast), Re-enable Unit Tests

Summary:
This change fixes the SaturatingMultiply<T>() function template to not cause undefined behavior with T=uint16_t.
Thanks to Richard Smith's contribution, it also no longer requires an integer division.

Patch by Richard Smith.

Reviewers: silvas, davidxl

Subscribers: rsmith, davidxl, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253870 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSamplePGO - Use newly introduced local variable. NFC.
Diego Novillo [Mon, 23 Nov 2015 15:24:13 +0000 (15:24 +0000)]
SamplePGO - Use newly introduced local variable. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253868 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Hexagon] Update instruction formats
Krzysztof Parzyszek [Mon, 23 Nov 2015 14:09:26 +0000 (14:09 +0000)]
[Hexagon] Update instruction formats

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253867 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoARM: address WoA division overflow crash
Martell Malone [Mon, 23 Nov 2015 13:11:39 +0000 (13:11 +0000)]
ARM: address WoA division overflow crash

Disable custom handling of signed 32-bit and 64-bit integer divide.
Add test cases for both 32-bit and 64-bit integer overflow crashes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253865 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[TableGen] Use std::remove_if instead of manually coded loops that called erase insid...
Craig Topper [Mon, 23 Nov 2015 07:19:10 +0000 (07:19 +0000)]
[TableGen] Use std::remove_if instead of manually coded loops that called erase inside them. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253857 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[TableGen] Use empty() instead of checking if size of vector is greater than or equal...
Craig Topper [Mon, 23 Nov 2015 07:19:08 +0000 (07:19 +0000)]
[TableGen] Use empty() instead of checking if size of vector is greater than or equal to 1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253856 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Mips] Remove an unnecessary wrapping of a predicate with std::ptr_fun. NFC
Craig Topper [Mon, 23 Nov 2015 07:19:06 +0000 (07:19 +0000)]
[Mips] Remove an unnecessary wrapping of a predicate with std::ptr_fun. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253855 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMove two Value Profiler data structs to InstrProfData.inc (NFC)
Xinliang David Li [Mon, 23 Nov 2015 05:29:51 +0000 (05:29 +0000)]
Move two Value Profiler data structs to InstrProfData.inc (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253848 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PGO] Fix remaining bugs in ProfData template file (when used by compiler-rt)
Xinliang David Li [Mon, 23 Nov 2015 03:49:07 +0000 (03:49 +0000)]
[PGO] Fix remaining bugs in ProfData template file (when used by compiler-rt)

1. move const qualifier out of raw header field type as runtime use of the header
   needs to initialze the fields
2. use C style casting for integer types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253844 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Analysis/CallGraph] Switch dump() definitions over to LLVM_DUMP_METHOD.
Davide Italiano [Mon, 23 Nov 2015 02:58:42 +0000 (02:58 +0000)]
[Analysis/CallGraph] Switch dump() definitions over to LLVM_DUMP_METHOD.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253842 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LoopStrengthReduce] Mark dump() definitions as LLVM_DUMP_METHOD.
Davide Italiano [Mon, 23 Nov 2015 02:47:30 +0000 (02:47 +0000)]
[LoopStrengthReduce] Mark dump() definitions as LLVM_DUMP_METHOD.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253841 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd const qualifier for FunctionInfoIndex in ModuleLinker and linkInModule() (NFC)
Mehdi Amini [Mon, 23 Nov 2015 01:59:16 +0000 (01:59 +0000)]
Add const qualifier for FunctionInfoIndex in ModuleLinker and linkInModule() (NFC)

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253840 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd const qualifier on FunctionInfoIndex::hasExportedFunctions() (NFC)
Mehdi Amini [Mon, 23 Nov 2015 01:59:12 +0000 (01:59 +0000)]
Add const qualifier on FunctionInfoIndex::hasExportedFunctions() (NFC)

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253839 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert a portion of r253836 that seems to have broke a couple bots.
Craig Topper [Sun, 22 Nov 2015 22:43:40 +0000 (22:43 +0000)]
Revert a portion of r253836 that seems to have broke a couple bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253838 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[SCEV] Use C++11'isms
Sanjoy Das [Sun, 22 Nov 2015 21:20:13 +0000 (21:20 +0000)]
[SCEV] Use C++11'isms

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253837 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[TableGen] Use range-based for loops. NFC
Craig Topper [Sun, 22 Nov 2015 20:46:24 +0000 (20:46 +0000)]
[TableGen] Use range-based for loops. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253836 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[TableGen] Use std::fill instead of a manually coded loop. NFC
Craig Topper [Sun, 22 Nov 2015 20:46:22 +0000 (20:46 +0000)]
[TableGen] Use std::fill instead of a manually coded loop. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253835 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFurther simplify from r253832 with some unique_ptr and coalescing conditions
David Blaikie [Sun, 22 Nov 2015 20:11:21 +0000 (20:11 +0000)]
Further simplify from r253832 with some unique_ptr and coalescing conditions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253834 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFurther simplify from r253832, removing unnecessary intermediate lambdas
David Blaikie [Sun, 22 Nov 2015 20:02:58 +0000 (20:02 +0000)]
Further simplify from r253832, removing unnecessary intermediate lambdas

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253833 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[TableGen] Use std::any_of and std::find instead of manual loops. NFC
Craig Topper [Sun, 22 Nov 2015 19:27:02 +0000 (19:27 +0000)]
[TableGen] Use std::any_of and std::find instead of manual loops. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253832 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[X86][FMA] Regenerate tests.
Simon Pilgrim [Sun, 22 Nov 2015 19:05:53 +0000 (19:05 +0000)]
[X86][FMA] Regenerate tests.

Fixes some broken checks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253830 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[MDBuilder] Simplify code using initializer lists. NFC.
Benjamin Kramer [Sun, 22 Nov 2015 18:03:17 +0000 (18:03 +0000)]
[MDBuilder] Simplify code using initializer lists. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253826 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[SCEV] Simplify code. NFC.
Benjamin Kramer [Sun, 22 Nov 2015 17:27:27 +0000 (17:27 +0000)]
[SCEV] Simplify code. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253825 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[X86][AVX] Added load splat tests.
Simon Pilgrim [Sun, 22 Nov 2015 16:52:16 +0000 (16:52 +0000)]
[X86][AVX] Added load splat tests.

Placeholder for upcoming patch for PR23022.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253824 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemove duplicate getValueType() calls. NFCI.
Simon Pilgrim [Sun, 22 Nov 2015 16:49:38 +0000 (16:49 +0000)]
Remove duplicate getValueType() calls. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253823 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert r253810. The builds should be fine now.
Krzysztof Parzyszek [Sun, 22 Nov 2015 16:13:51 +0000 (16:13 +0000)]
Revert r253810. The builds should be fine now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253822 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Utils] Updated shuffle fuzz script to generate more modern (valid) IR.
Simon Pilgrim [Sun, 22 Nov 2015 16:04:32 +0000 (16:04 +0000)]
[Utils] Updated shuffle fuzz script to generate more modern (valid) IR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253821 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAvoid dependency between TableGen and CodeGen
Krzysztof Parzyszek [Sun, 22 Nov 2015 15:20:19 +0000 (15:20 +0000)]
Avoid dependency between TableGen and CodeGen

Duplicate a few common definitions between DFAPacketizer.cpp and
DFAPacketizerEmitter.cpp to avoid including files from CodeGen
in TableGen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253820 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAVX-512: Optimized INSERT_SUBVECTOR for i1 vector types
Elena Demikhovsky [Sun, 22 Nov 2015 13:57:38 +0000 (13:57 +0000)]
AVX-512: Optimized INSERT_SUBVECTOR for i1 vector types

ISERT_SUBVECTOR for i1 vectors may be done with shifts, when we insert into the lower part, or into the upper part, on into all-zero vector.
CONCAT_VECTORS uses ISERT_SUBVECTOR.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253819 91177308-0d34-0410-b5e6-96231b3b80d8