platform/upstream/llvm.git
8 years ago[XRay] ARM 32-bit no-Thumb support in LLVM
Dean Michael Berris [Mon, 19 Sep 2016 00:54:35 +0000 (00:54 +0000)]
[XRay] ARM 32-bit no-Thumb support in LLVM

This is a port of XRay to ARM 32-bit, without Thumb support yet. The XRay instrumentation support is moving up to AsmPrinter.
This is one of 3 commits to different repositories of XRay ARM port. The other 2 are:

https://reviews.llvm.org/D23932 (Clang test)
https://reviews.llvm.org/D23933 (compiler-rt)

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

llvm-svn: 281878

8 years ago[llvm-cov] Teach the coverage exporter about instantiation coverage
Vedant Kumar [Mon, 19 Sep 2016 00:38:29 +0000 (00:38 +0000)]
[llvm-cov] Teach the coverage exporter about instantiation coverage

While we're at it, re-use the logic from CoverageReport to compute
summaries.

llvm-svn: 281877

8 years ago[llvm-cov] Make a helper method static for re-use (NFC)
Vedant Kumar [Mon, 19 Sep 2016 00:38:25 +0000 (00:38 +0000)]
[llvm-cov] Make a helper method static for re-use (NFC)

llvm-svn: 281876

8 years ago[llvm-cov] Track function and instantiation coverage separately
Vedant Kumar [Mon, 19 Sep 2016 00:38:23 +0000 (00:38 +0000)]
[llvm-cov] Track function and instantiation coverage separately

These are distinct statistics which are useful to look at separately.

Example: say you have a template function "foo" with 5 instantiations
and only 3 of them are covered. Then this contributes (1/1) to the total
function coverage and (3/5) to the total instantiation coverage. I.e,
the old "Function Coverage" column has been renamed to "Instantiation
Coverage", and the new "Function Coverage" aggregates information from
the various instantiations of a function.

One benefit of making this switch is that the Line and Region coverage
columns will start making sense. Let's continue the example and assume
that the 5 instantiations of "foo" cover {2, 4, 6, 8, 10} out of 10
lines respectively. The new line coverage for "foo" is (10/10), not
(30/50).  The old scenario got confusing because we'd report that there
were more lines in a file than what was actually possible.

llvm-svn: 281875

8 years ago[llvm-cov] Don't recompute the 'Covered' field from *CoverageInfo (NFC)
Vedant Kumar [Mon, 19 Sep 2016 00:38:18 +0000 (00:38 +0000)]
[llvm-cov] Don't recompute the 'Covered' field from *CoverageInfo (NFC)

llvm-svn: 281874

8 years ago[llvm-cov] Make 'adjustColumnWidths' do less work
Vedant Kumar [Mon, 19 Sep 2016 00:38:16 +0000 (00:38 +0000)]
[llvm-cov] Make 'adjustColumnWidths' do less work

This drops some redundant calls to get{UniqueSourceFiles,
CoveredFunctions}. We can figure out the right column widths without
re-doing this expensive work.

This isn't NFC, but I don't want to check in another binary *.covmapping
file with long filenames in it. I tested this locally on a project with
some long filenames (FileCheck).

llvm-svn: 281873

8 years ago[llvm-cov] Drop another redundant 'No.' suffix
Vedant Kumar [Mon, 19 Sep 2016 00:38:14 +0000 (00:38 +0000)]
[llvm-cov] Drop another redundant 'No.' suffix

llvm-svn: 281872

8 years ago[utils] Delete the 'check-coverage-regressions' script
Vedant Kumar [Mon, 19 Sep 2016 00:38:11 +0000 (00:38 +0000)]
[utils] Delete the 'check-coverage-regressions' script

In practice, it's way too noisy.

It's also a maintenance burden, since we apparently can't add tests for
it without breaking some Windows setups (see: D22692).

llvm-svn: 281871

8 years agoHandle Invoke during sample profiler annotation: make it inlinable.
Dehao Chen [Sun, 18 Sep 2016 23:11:37 +0000 (23:11 +0000)]
Handle Invoke during sample profiler annotation: make it inlinable.

Summary: Previously we reline on inst-combine to remove inlinable invoke instructions. This causes trouble because a few extra optimizations are schedule early that could introduce too much CFG change (e.g. simplifycfg removes too much control flow). This patch handles invoke instruction in-place during sample profile annotation, so that we do not rely on instcombine to remove those invoke instructions.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

llvm-svn: 281870

8 years agoExtend title underline
Xinliang David Li [Sun, 18 Sep 2016 22:10:19 +0000 (22:10 +0000)]
Extend title underline

llvm-svn: 281869

8 years ago[AVX-512] Don't lower CVTPD2PS intrinsics to ISD::FP_ROUND with an X86 rounding mode...
Craig Topper [Sun, 18 Sep 2016 21:49:32 +0000 (21:49 +0000)]
[AVX-512] Don't lower CVTPD2PS intrinsics to ISD::FP_ROUND with an X86 rounding mode encoding in the second operand. This immediate should only be 0 or 1 and indicates if the truncation loses precision.

Also enhance an assert in SelectionDAG::getNode to flag this sort of problem in the future.

llvm-svn: 281868

8 years ago[AVX-512] Stop lowering avx512_mask_sqrt intrinsics to ISD:FSQRT with a second operan...
Craig Topper [Sun, 18 Sep 2016 21:49:28 +0000 (21:49 +0000)]
[AVX-512] Stop lowering avx512_mask_sqrt intrinsics to ISD:FSQRT with a second operand containing an X86 specific rounding mode encoding that doesn't belong.

llvm-svn: 281867

8 years ago[libFuzzer] add -print_coverage=1 flag to print coverage directly from libFuzzer
Kostya Serebryany [Sun, 18 Sep 2016 21:47:08 +0000 (21:47 +0000)]
[libFuzzer] add -print_coverage=1 flag to print coverage directly from libFuzzer

llvm-svn: 281866

8 years agoFix covered-switch-default warning
Simon Pilgrim [Sun, 18 Sep 2016 21:08:35 +0000 (21:08 +0000)]
Fix covered-switch-default warning

llvm-svn: 281865

8 years ago[CostModel][X86] Added scalar float op costs
Simon Pilgrim [Sun, 18 Sep 2016 21:01:20 +0000 (21:01 +0000)]
[CostModel][X86] Added scalar float op costs

llvm-svn: 281864

8 years agoRename tests
Simon Pilgrim [Sun, 18 Sep 2016 20:25:41 +0000 (20:25 +0000)]
Rename tests

llvm-svn: 281863

8 years ago[X86] Fix typo in comment. NFC
Craig Topper [Sun, 18 Sep 2016 18:59:38 +0000 (18:59 +0000)]
[X86] Fix typo in comment. NFC

llvm-svn: 281862

8 years ago[AVX-512] Add memory load patterns for the legacy SSE scalar fp to integer conversion...
Craig Topper [Sun, 18 Sep 2016 18:59:36 +0000 (18:59 +0000)]
[AVX-512] Add memory load patterns for the legacy SSE scalar fp to integer conversion intrinsics to be consistent across all intruction sets.

llvm-svn: 281861

8 years ago[AVX-512] Remove COPY_TO_REGCLASS from a few patterns that already had the correct...
Craig Topper [Sun, 18 Sep 2016 18:59:33 +0000 (18:59 +0000)]
[AVX-512] Remove COPY_TO_REGCLASS from a few patterns that already had the correct register class.

llvm-svn: 281860

8 years agoFix built bot failure
Xinliang David Li [Sun, 18 Sep 2016 18:52:08 +0000 (18:52 +0000)]
Fix built bot failure

llvm-svn: 281859

8 years ago[Profile] Implement select instruction instrumentation in IR PGO
Xinliang David Li [Sun, 18 Sep 2016 18:34:07 +0000 (18:34 +0000)]
[Profile] Implement select instruction instrumentation in IR PGO

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

llvm-svn: 281858

8 years agoclang-format: [JS] Do not wrap taze annotation comments.
Martin Probst [Sun, 18 Sep 2016 17:33:51 +0000 (17:33 +0000)]
clang-format: [JS] Do not wrap taze annotation comments.

Summary:
`// taze: ... from ...` comments are used help tools where a
specific global symbol comes from.

Before:
    // taze: many, different, symbols from
    // 'some_long_location_here'

After:
    // taze: many, different, symbols from 'some_long_location_here'

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 281857

8 years agoclang-format: [JS] ASI insertion after boolean literals.
Martin Probst [Sun, 18 Sep 2016 17:21:52 +0000 (17:21 +0000)]
clang-format: [JS] ASI insertion after boolean literals.

Summary:
Before when a semicolon was missing after a boolean literal:
    a = true
    return 1;

clang-format would parse this as one line and format as:
    a = true return 1;

It turns out that C++ does not consider `true` and `false` to be literals, we
have to check for that explicitly.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 281856

8 years agoCodeGen: mark ObjC cstring literals as unnamed_addr
Saleem Abdulrasool [Sun, 18 Sep 2016 16:12:14 +0000 (16:12 +0000)]
CodeGen: mark ObjC cstring literals as unnamed_addr

These are all emitted into a section with a cstring_literal attribute.  The
attribute permits the linker to coalesce the string contents.  The address of
the strings are not important.

llvm-svn: 281855

8 years agoCodeGen: mark ObjC cstring literals as constant
Saleem Abdulrasool [Sun, 18 Sep 2016 16:12:04 +0000 (16:12 +0000)]
CodeGen: mark ObjC cstring literals as constant

These strings are constants, mark them as such.  This doesn't matter too much in
practice on MachO since the constants are placed into a special section and not
referred to directly.

llvm-svn: 281854

8 years ago[Loop Vectorizer] Consecutive memory access - fixed and simplified
Elena Demikhovsky [Sun, 18 Sep 2016 13:56:08 +0000 (13:56 +0000)]
[Loop Vectorizer] Consecutive memory access - fixed and simplified

Amended consecutive memory access detection in Loop Vectorizer.
Load/Store were not handled properly without preceding GEP instruction.

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

llvm-svn: 281853

8 years ago[X86][SSE] Improve recognition of uitofp conversions that can be performed as sitofp
Simon Pilgrim [Sun, 18 Sep 2016 12:45:23 +0000 (12:45 +0000)]
[X86][SSE] Improve recognition of uitofp conversions that can be performed as sitofp

With D24253 we can now use SelectionDAG::SignBitIsZero with vector operations.

This patch uses SelectionDAG::SignBitIsZero to recognise that a zero sign bit means that we can use a sitofp instead of a uitofp (which is not directly support on pre-AVX512 hardware).

While AVX512 does provide support for uitofp, the conversion to sitofp should not cause any regressions.

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

llvm-svn: 281852

8 years ago[Loop vectorizer] Simplified GEP cloning. NFC.
Elena Demikhovsky [Sun, 18 Sep 2016 09:22:54 +0000 (09:22 +0000)]
[Loop vectorizer] Simplified GEP cloning. NFC.

Simplified GEP cloning in vectorizeMemoryInstruction().
Added an assertion that checks consecutive GEP, which should have only one loop-variant operand.

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

llvm-svn: 281851

8 years agoGPGPU: add missing REQUIRES line to test case
Tobias Grosser [Sun, 18 Sep 2016 08:57:38 +0000 (08:57 +0000)]
GPGPU: add missing REQUIRES line to test case

llvm-svn: 281850

8 years agoGPGPU: Do not run mostly sequential kernels in GPU
Tobias Grosser [Sun, 18 Sep 2016 08:31:09 +0000 (08:31 +0000)]
GPGPU: Do not run mostly sequential kernels in GPU

In case sequential kernels are found deeper in the loop tree than any parallel
kernel, the overall scop is probably mostly sequential. Hence, run it on the
CPU.

llvm-svn: 281849

8 years agoGPGPU: Dynamically ensure 'sufficient compute'
Tobias Grosser [Sun, 18 Sep 2016 06:50:35 +0000 (06:50 +0000)]
GPGPU: Dynamically ensure 'sufficient compute'

Offloading to a GPU is only beneficial if there is a sufficient amount of
compute that can be accelerated. Many kernels just have a very small number
of dynamic compute, which means GPU acceleration is not beneficial. We
compute at run-time an approximation of how many dynamic instructions will be
executed and fall back to CPU code in case this number is not sufficiently
large. To keep the run-time checking code simple, we over-approximate the
number of instructions executed in each statement by computing the volume of
the rectangular hull of its iteration space.

llvm-svn: 281848

8 years agoGPGPU: Make test cases independent of register numbering [NFC]
Tobias Grosser [Sun, 18 Sep 2016 06:50:28 +0000 (06:50 +0000)]
GPGPU: Make test cases independent of register numbering [NFC]

llvm-svn: 281847

8 years agoChange the order of the splitted store from high - low to low - high.
Wei Mi [Sun, 18 Sep 2016 06:10:32 +0000 (06:10 +0000)]
Change the order of the splitted store from high - low to low - high.
It is a trivial change which could make the testcase easier to be reused
for the store splitting in CodeGenPrepare.

llvm-svn: 281846

8 years ago[libFuzzer] use 'if guard' instead of 'if guard >= 0' with trace-pc; change the guard...
Kostya Serebryany [Sun, 18 Sep 2016 04:52:23 +0000 (04:52 +0000)]
[libFuzzer] use 'if guard' instead of 'if guard >= 0' with trace-pc; change the guard type to intptr_t; use separate array for 8-bit counters

llvm-svn: 281845

8 years ago[llvm-objump] Simplify the code. NFCI.
Davide Italiano [Sun, 18 Sep 2016 04:39:15 +0000 (04:39 +0000)]
[llvm-objump] Simplify the code. NFCI.

llvm-svn: 281844

8 years ago[lib/LTO] Try harder to reduce code duplication. NFCI.
Davide Italiano [Sat, 17 Sep 2016 22:32:42 +0000 (22:32 +0000)]
[lib/LTO] Try harder to reduce code duplication. NFCI.

llvm-svn: 281843

8 years ago[X86][SSE] Added vector udiv combine tests
Simon Pilgrim [Sat, 17 Sep 2016 22:02:23 +0000 (22:02 +0000)]
[X86][SSE] Added vector udiv combine tests

llvm-svn: 281842

8 years ago[X86][SSE] Added vector fcopysign combine tests
Simon Pilgrim [Sat, 17 Sep 2016 21:31:34 +0000 (21:31 +0000)]
[X86][SSE] Added vector fcopysign combine tests

Also demonstrating the poor lowering of fcopysign...

llvm-svn: 281841

8 years ago[ThinLTO] Ensure anonymous globals renamed even at -O0
Teresa Johnson [Sat, 17 Sep 2016 20:40:16 +0000 (20:40 +0000)]
[ThinLTO] Ensure anonymous globals renamed even at -O0

Summary:
This fixes an issue when files are compiled with -flto=thin
at default -O0. We need to rename anonymous globals before attempting
to write the module summary because all values need names for
the summary. This was happening at -O1 and above, but not before
the early exit when constructing the pipeline for -O0.

Also add an internal -prepare-for-thinlto option to enable this
to be tested via opt.

Fixes PR30419.

Reviewers: mehdi_amini

Subscribers: probinson, llvm-commits, mehdi_amini

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

llvm-svn: 281840

8 years ago[X86][SSE] Added vector mul combine tests
Simon Pilgrim [Sat, 17 Sep 2016 20:06:16 +0000 (20:06 +0000)]
[X86][SSE] Added vector mul combine tests

llvm-svn: 281839

8 years agoGPGPU: Store back non-read-only scalars
Tobias Grosser [Sat, 17 Sep 2016 19:22:31 +0000 (19:22 +0000)]
GPGPU: Store back non-read-only scalars

We may generate GPU kernels that store into scalars in case we run some
sequential code on the GPU because the remaining data is expected to already be
on the GPU. For these kernels it is important to not keep the scalar values
in thread-local registers, but to store them back to the corresponding device
memory objects that backs them up.

We currently only store scalars back at the end of a kernel. This is only
correct if precisely one thread is executed. In case more than one thread may
be run, we currently invalidate the scop. To support such cases correctly,
we would need to always load and store back from a corresponding global
memory slot instead of a thread-local alloca slot.

llvm-svn: 281838

8 years agoGPGPU: Detect read-only scalar arrays ...
Tobias Grosser [Sat, 17 Sep 2016 19:22:18 +0000 (19:22 +0000)]
GPGPU: Detect read-only scalar arrays ...

and pass these by value rather than by reference.

llvm-svn: 281837

8 years ago[ELF] - Fix comment. NFC.
George Rimar [Sat, 17 Sep 2016 19:21:05 +0000 (19:21 +0000)]
[ELF] - Fix comment. NFC.

llvm-svn: 281836

8 years ago[ELF] - Added comments. NFC.
George Rimar [Sat, 17 Sep 2016 19:17:25 +0000 (19:17 +0000)]
[ELF] - Added comments. NFC.

llvm-svn: 281835

8 years ago[X86][SSE] Improve target shuffle mask extraction
Simon Pilgrim [Sat, 17 Sep 2016 18:50:54 +0000 (18:50 +0000)]
[X86][SSE] Improve target shuffle mask extraction

Add ability to extract vXi64 'vzext_movl' masks on 32-bit targets

llvm-svn: 281834

8 years ago[X86][AVX] Test target shuffle combining on 32 and 64-bit targets
Simon Pilgrim [Sat, 17 Sep 2016 18:42:41 +0000 (18:42 +0000)]
[X86][AVX] Test target shuffle combining on 32 and 64-bit targets

llvm-svn: 281833

8 years ago[ELF] - Linkerscript: change locationcounter.s to use llvm-objdump
George Rimar [Sat, 17 Sep 2016 18:35:24 +0000 (18:35 +0000)]
[ELF] - Linkerscript: change locationcounter.s to use llvm-objdump

Previously it used llvm-readobj -s, now changed to llvm-objdump -section-headers,
that reduced the output significantly and helps to read/support it.

llvm-svn: 281832

8 years ago[ELF] - SEGMENT_START's default argument can be an expression
George Rimar [Sat, 17 Sep 2016 18:14:56 +0000 (18:14 +0000)]
[ELF] - SEGMENT_START's default argument can be an expression

Our implementation supported integer value previously.
ld can use expression,
for example, it is OK to write
 . = SEGMENT_START("foobar", .);

Patch implements that.

llvm-svn: 281831

8 years ago[X86][AVX2] Add target shuffle constant folding tests
Simon Pilgrim [Sat, 17 Sep 2016 17:42:15 +0000 (17:42 +0000)]
[X86][AVX2] Add target shuffle constant folding tests

llvm-svn: 281830

8 years ago[X86][AVX] Add target shuffle constant folding tests
Simon Pilgrim [Sat, 17 Sep 2016 17:41:14 +0000 (17:41 +0000)]
[X86][AVX] Add target shuffle constant folding tests

llvm-svn: 281829

8 years ago[X86][XOP] Add target shuffle constant folding tests
Simon Pilgrim [Sat, 17 Sep 2016 17:40:40 +0000 (17:40 +0000)]
[X86][XOP] Add target shuffle constant folding tests

llvm-svn: 281828

8 years ago[X86][SSSE3] Add target shuffle constant folding tests
Simon Pilgrim [Sat, 17 Sep 2016 17:40:08 +0000 (17:40 +0000)]
[X86][SSSE3] Add target shuffle constant folding tests

llvm-svn: 281827

8 years ago[clang-rename] Fix handling of unchanged files
Alexander Shaposhnikov [Sat, 17 Sep 2016 17:08:47 +0000 (17:08 +0000)]
[clang-rename] Fix handling of unchanged files

Fix the output of clang-rename for the files without modifications.
Update the code in clang-reorder-fields/tool/ClangReorderFields.cpp
to avoid inconsistency.

Example:
a.h:
struct A {};
a.cpp:
#include "a.h"
int main() { return 0; }

Before the changes the output looks like this:
clang-rename -qualified-name=A -new-name=B a.cpp
<<<<<INVALID SOURCE LOCATION>>>>>

Test plan: make -j8 check-clang-tools

Differential revision: https://reviews.llvm.org/D24634

llvm-svn: 281826

8 years ago[Hexagon] segv while processing SUnit with nullNodePtr
Ron Lieberman [Sat, 17 Sep 2016 16:21:09 +0000 (16:21 +0000)]
[Hexagon] segv while processing SUnit with nullNodePtr

Added BoundaryNode check to isBestZeroLatency function.

llvm-svn: 281825

8 years agoAMDGPU: Fix broken FrameIndex handling
Matt Arsenault [Sat, 17 Sep 2016 16:09:55 +0000 (16:09 +0000)]
AMDGPU: Fix broken FrameIndex handling

We were trying to avoid using a FrameIndex operand in non-pointer
operands in a convoluted way, and would break because of
using TargetFrameIndex. The TargetFrameIndex should only be used
in the case where it makes sense to fold it as part of the addressing
mode, otherwise it requires materialization like a normal constant.
This wasn't working reliably and failed in the added testcase, hitting
the assert when processing the frame index.

The TargetFrameIndex was coming from trying to produce an AssertZext
limiting the maximum stack size. I'm not sure this was correct to begin
with, because it is apparently possible to have a single workitem
dispatch that requires all 4G of private memory.

llvm-svn: 281824

8 years agoAMDGPU: Rename spill operands to match real instruction
Matt Arsenault [Sat, 17 Sep 2016 15:52:37 +0000 (15:52 +0000)]
AMDGPU: Rename spill operands to match real instruction

llvm-svn: 281823

8 years agoAMDGPU: Push bitcasts through build_vector
Matt Arsenault [Sat, 17 Sep 2016 15:44:16 +0000 (15:44 +0000)]
AMDGPU: Push bitcasts through build_vector

This reduces the number of copies and reg_sequences
when using fp constant vectors. This significantly
reduces the code size in local-stack-alloc-bug.ll

llvm-svn: 281822

8 years ago[tsan] Update fork_atexit.cc to consistently print to stderr (and not stdout)
Kuba Brecka [Sat, 17 Sep 2016 14:39:53 +0000 (14:39 +0000)]
[tsan] Update fork_atexit.cc to consistently print to stderr (and not stdout)

llvm-svn: 281821

8 years ago[tsan] Update signal_cond.cc to write to stderr intead of stdout
Kuba Brecka [Sat, 17 Sep 2016 14:33:36 +0000 (14:33 +0000)]
[tsan] Update signal_cond.cc to write to stderr intead of stdout

llvm-svn: 281820

8 years agoWhen replacements have the same offset, make replacements with smaller length order...
Eric Liu [Sat, 17 Sep 2016 12:26:42 +0000 (12:26 +0000)]
When replacements have the same offset, make replacements with smaller length order first in the set.

Summary:
No behavioral change intended. The change makes iterating the replacements set more intuitive in Replacements class implementation. Previously, insertion is ordered before an deletion/replacement with the same offset, which is counter-intuitive for implementation, especially for a followup patch to support adding insertions around replacements.

With the current ordering, we only need to make `applyAllReplacements` iterate the replacements set reversely when applying them so that deletion/replacement is still applied before insertion with the same offset.

Reviewers: klimek, djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 281819

8 years ago[ELF] Linkerscript: fixed bug about commands processing.
George Rimar [Sat, 17 Sep 2016 09:50:10 +0000 (09:50 +0000)]
[ELF] Linkerscript: fixed bug about commands processing.

It was possible situation about some commands just were not processed
(were skipped) because of a bug appeared when constraint checking used.

Testcase is attached.

llvm-svn: 281818

8 years ago[ELF] - Fixed mistypes in comments. NFC.
George Rimar [Sat, 17 Sep 2016 07:31:49 +0000 (07:31 +0000)]
[ELF] - Fixed mistypes in comments. NFC.

llvm-svn: 281817

8 years agoclang-format: [JS] Fix a crash in handledTemplateStrings.
Daniel Jasper [Sat, 17 Sep 2016 07:20:36 +0000 (07:20 +0000)]
clang-format: [JS] Fix a crash in handledTemplateStrings.

llvm-svn: 281816

8 years ago[compiler-rt] Disable building of profiling runtime when LLVM_USE_SANITIZER is set
Kuba Brecka [Sat, 17 Sep 2016 06:31:23 +0000 (06:31 +0000)]
[compiler-rt] Disable building of profiling runtime when LLVM_USE_SANITIZER is set

Currently, when doing a ASanified build of LLVM (with Clang, compiler-rt and libcxx) via -DLLVM_USE_SANITIZER=Address and not using any other options, we already disable building of sanitizer runtimes (because they themselves can’t be sanitized) and also exclude the sanitizer tests. However, the same is not done for the profiling runtime, which will build fine, but then all the tests fail due to linking errors. Let’s disable the profiling runtime as well (when LLVM_USE_SANITIZER is set).

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

llvm-svn: 281815

8 years ago[libFuzzer] properly reset the guards when reseting the coverage. Also try to fix...
Kostya Serebryany [Sat, 17 Sep 2016 06:01:55 +0000 (06:01 +0000)]
[libFuzzer] properly reset the guards when reseting the coverage. Also try to fix check-fuzzer on the bot

llvm-svn: 281814

8 years agoDon't create a SymbolTable in Function when the LLVMContext discards value names...
Mehdi Amini [Sat, 17 Sep 2016 06:00:02 +0000 (06:00 +0000)]
Don't create a SymbolTable in Function when the LLVMContext discards value names (NFC)

The ValueSymbolTable is used to detect name conflict and rename
instructions automatically. This is not needed when the value
names are automatically discarded by the LLVMContext.
No functional change intended, just saving a little bit of memory.

This is a recommit of r281806 after fixing the accessor to return
a pointer instead of a reference and updating all the call-sites.

llvm-svn: 281813

8 years ago[MIR Parser] Fix Build!
Mehdi Amini [Sat, 17 Sep 2016 05:41:02 +0000 (05:41 +0000)]
[MIR Parser] Fix Build!

Last-second refactoring before push was bad idea...

llvm-svn: 281812

8 years agoMIR Parser: issue an error when the Context discard value names.
Mehdi Amini [Sat, 17 Sep 2016 05:33:58 +0000 (05:33 +0000)]
MIR Parser: issue an error when the Context discard value names.

This is in line with the LLParser behavior

llvm-svn: 281811

8 years ago[libFuzzer] change trace-pc to use 8-byte guards
Kostya Serebryany [Sat, 17 Sep 2016 05:04:47 +0000 (05:04 +0000)]
[libFuzzer] change trace-pc to use 8-byte guards

llvm-svn: 281810

8 years ago[sanitizer-coverage] change trace-pc to use 8-byte guards
Kostya Serebryany [Sat, 17 Sep 2016 05:03:05 +0000 (05:03 +0000)]
[sanitizer-coverage] change trace-pc to use 8-byte guards

llvm-svn: 281809

8 years agoRevert "Don't create a SymbolTable in Function when the LLVMContext discards value...
Mehdi Amini [Sat, 17 Sep 2016 04:36:46 +0000 (04:36 +0000)]
Revert "Don't create a SymbolTable in Function when the LLVMContext discards value names (NFC)"

This reverts commit r281806. It introduces undefined behavior as an
API is returning a reference to the Symtab

llvm-svn: 281808

8 years agoDon't create a SymbolTable in Function when the LLVMContext discards value names...
Mehdi Amini [Sat, 17 Sep 2016 03:39:01 +0000 (03:39 +0000)]
Don't create a SymbolTable in Function when the LLVMContext discards value names (NFC)

The ValueSymbolTable is used to detect name conflict and rename
instructions automatically. This is not needed when the value
names are automatically discarded by the LLVMContext.
No functional change intended, just saving a little bit of memory.

llvm-svn: 281806

8 years agoAttempt to fix buildbot.
Rui Ueyama [Sat, 17 Sep 2016 02:34:50 +0000 (02:34 +0000)]
Attempt to fix buildbot.

llvm-svn: 281805

8 years agoFix boolean logic error in BreakpointID.
Zachary Turner [Sat, 17 Sep 2016 02:34:40 +0000 (02:34 +0000)]
Fix boolean logic error in BreakpointID.

llvm-svn: 281804

8 years agoUse named struct instead of unnamed std::pair.
Rui Ueyama [Sat, 17 Sep 2016 02:23:40 +0000 (02:23 +0000)]
Use named struct instead of unnamed std::pair.

It is important to give members names for readability.

llvm-svn: 281803

8 years agoDefine a versatile utility function and use it instead of a single purpose one.
Rui Ueyama [Sat, 17 Sep 2016 02:15:28 +0000 (02:15 +0000)]
Define a versatile utility function and use it instead of a single purpose one.

llvm-svn: 281802

8 years agoRemove unnecessary namespace specifiers.
Rui Ueyama [Sat, 17 Sep 2016 02:10:15 +0000 (02:10 +0000)]
Remove unnecessary namespace specifiers.

llvm-svn: 281801

8 years agoAMDGPU: Use i64 scalar compare instructions
Matt Arsenault [Sat, 17 Sep 2016 02:02:19 +0000 (02:02 +0000)]
AMDGPU: Use i64 scalar compare instructions

VI added eq/ne for i64, so use them.

llvm-svn: 281800

8 years agoConvert many functions to use StringRefs.
Zachary Turner [Sat, 17 Sep 2016 02:00:02 +0000 (02:00 +0000)]
Convert many functions to use StringRefs.

Where possible, remove the const char* version.  To keep the
risk and impact here minimal, I've only done the simplest
functions.

In the process, I found a few opportunities for adding some
unit tests, so I added those as well.

Tested on Windows, Linux, and OSX.

llvm-svn: 281799

8 years agoCodeGen: refactor the ObjC cstring literal creation
Saleem Abdulrasool [Fri, 16 Sep 2016 23:41:13 +0000 (23:41 +0000)]
CodeGen: refactor the ObjC cstring literal creation

This refactors the cstring literal creation as mentioned in the couple of FIXMEs
littered in the various invocations to CreateMetadataVar.  This centralises the
definition of the literals, and will enable changing the literal creation to a
single site.  NFC.

llvm-svn: 281798

8 years agoFix a couple of wrong-code bugs in switch-on-constant optimization:
Richard Smith [Fri, 16 Sep 2016 23:30:39 +0000 (23:30 +0000)]
Fix a couple of wrong-code bugs in switch-on-constant optimization:

 * recurse through intermediate LabelStmts and AttributedStmts when checking
   whether a statement inside a switch declares a variable
 * if the end of a compound statement is reachable from the chosen case label,
   and the compound statement contains a variable declaration, it's not valid
   to just emit the contents of the compound statement -- we must emit the
   statement itself or we lose the scope (and thus end lifetimes at the wrong
   point)

llvm-svn: 281797

8 years agoAdd REQUIRES line.
Peter Collingbourne [Fri, 16 Sep 2016 22:56:12 +0000 (22:56 +0000)]
Add REQUIRES line.

llvm-svn: 281796

8 years agoPartially fill Info stream with proper values.
Rui Ueyama [Fri, 16 Sep 2016 22:51:17 +0000 (22:51 +0000)]
Partially fill Info stream with proper values.

llvm-svn: 281795

8 years agoTry to fix a few bots.
Rafael Espindola [Fri, 16 Sep 2016 22:47:34 +0000 (22:47 +0000)]
Try to fix a few bots.

llvm-svn: 281794

8 years agoconfigure: Add amdgcn-mesa-mesa3d target
Tom Stellard [Fri, 16 Sep 2016 22:43:33 +0000 (22:43 +0000)]
configure: Add amdgcn-mesa-mesa3d target

llvm-svn: 281793

8 years agoamdgcn-amdhsa: Add get_num_groups implementation
Tom Stellard [Fri, 16 Sep 2016 22:43:31 +0000 (22:43 +0000)]
amdgcn-amdhsa: Add get_num_groups implementation

llvm-svn: 281792

8 years agoamdgcn-amdhsa: Add get_global_size() implementation
Tom Stellard [Fri, 16 Sep 2016 22:43:29 +0000 (22:43 +0000)]
amdgcn-amdhsa: Add get_global_size() implementation

llvm-svn: 281791

8 years agoAdd target triples to fix test on non-x86.
Peter Collingbourne [Fri, 16 Sep 2016 22:26:45 +0000 (22:26 +0000)]
Add target triples to fix test on non-x86.

llvm-svn: 281790

8 years agoAMDGPU/SI: Fix kernel argument ABI for HSA
Tom Stellard [Fri, 16 Sep 2016 22:20:24 +0000 (22:20 +0000)]
AMDGPU/SI: Fix kernel argument ABI for HSA

Summary: i8, i16, and f16 values are not extended to 32-bit in the HSA kernel ABI.

Reviewers: arsenm

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, llvm-commits, yaxunl

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

llvm-svn: 281789

8 years ago[CMake] Support symlinks with the same name as the binary
Chris Bieneman [Fri, 16 Sep 2016 22:19:19 +0000 (22:19 +0000)]
[CMake] Support symlinks with the same name as the binary

This supports creating symlinks to tools in different directories than
the tool is built to. This is useful for the LLDB framework build which
I’m sending patches for shortly.

llvm-svn: 281788

8 years ago[InstCombine] canonicalize vector select with constant vector condition to shuffle
Sanjay Patel [Fri, 16 Sep 2016 22:16:18 +0000 (22:16 +0000)]
[InstCombine] canonicalize vector select with constant vector condition to shuffle

As discussed on llvm-dev ( http://lists.llvm.org/pipermail/llvm-dev/2016-August/104210.html ):
turn a vector select with constant condition operand into a shuffle as a canonicalization step.
Shuffles may be easier to reason about in conjunction with other shuffles and insert/extract.

Possible known (minor?) regressions from this change are filed as:
https://llvm.org/bugs/show_bug.cgi?id=28530
https://llvm.org/bugs/show_bug.cgi?id=28531
https://llvm.org/bugs/show_bug.cgi?id=30371

If something terrible happens to perf after this commit, feel free to revert until a backend
fix is in place.

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

llvm-svn: 281787

8 years agoAMDGPU: Allow some control flow intrinsics to be CSEd
Matt Arsenault [Fri, 16 Sep 2016 22:11:18 +0000 (22:11 +0000)]
AMDGPU: Allow some control flow intrinsics to be CSEd

These clean up some unnecessary or instructions in
cases with complex loops.

In the original testcase I noticed this, the same
or with exec was repeated 5 or 6 times in a row. With
this only one is emitted or sometimes a copy.

llvm-svn: 281786

8 years agoCodeGen: Add more checks to nobuiltin.c test, add a negative test.
Peter Collingbourne [Fri, 16 Sep 2016 22:05:53 +0000 (22:05 +0000)]
CodeGen: Add more checks to nobuiltin.c test, add a negative test.

llvm-svn: 281785

8 years ago[safestack] Fix assertion failure in stack coloring.
Evgeniy Stepanov [Fri, 16 Sep 2016 22:04:10 +0000 (22:04 +0000)]
[safestack] Fix assertion failure in stack coloring.

This is a fix for PR30318.

Clang may generate IR where an alloca is already live when entering a
BB with lifetime.start. In this case, conservatively extend the
alloca lifetime all the way back to the block entry.

llvm-svn: 281784

8 years ago[RegAllocGreedy] Fix the list of NewVRegs for last chance recoloring.
Quentin Colombet [Fri, 16 Sep 2016 22:00:50 +0000 (22:00 +0000)]
[RegAllocGreedy] Fix the list of NewVRegs for last chance recoloring.

When trying to recolor a register we may split live-ranges in the
process. When we create new live-ranges we will have to process them,
but when we move a register from Assign to Split, the allocation is not
changed until the whole recoloring session is successful.
Therefore, only push the live-ranges that changed from Assign to
Split when the recoloring is successful.

Same as the previous commit, I was not able to produce a test case that
reproduce the problem with in-tree targets.

Note: The bug has been here since the recoloring scheme has been added
back in r200883 (Feb 2014).

llvm-svn: 281783

8 years ago[RegAllocGreedy] Fix an assertion and condition when last chance recoloring is used.
Quentin Colombet [Fri, 16 Sep 2016 22:00:42 +0000 (22:00 +0000)]
[RegAllocGreedy] Fix an assertion and condition when last chance recoloring is used.

When last chance recoloring is used, the list of NewVRegs may not be
empty when calling selectOrSplitImpl. Indeed, another coloring may have
taken place with splitting/spilling in the same recoloring session.

Relax an assertion to take this into account and adapt a condition to
act as if the NewVRegs were local to this selectOrSplitImpl instance.

Unfortunately I am unable to produce a test case for this, I was only
able to reproduce the conditions on an out-of-tree target.

llvm-svn: 281782

8 years agoAMDGPU: Refactor kernel argument lowering
Tom Stellard [Fri, 16 Sep 2016 21:53:00 +0000 (21:53 +0000)]
AMDGPU: Refactor kernel argument lowering

Summary:
The main challenge in lowering kernel arguments for AMDGPU is determing the
memory type of the argument.  The generic calling convention code assumes
that only legal register types can be stored in memory, but this is not the
case for AMDGPU.

This consolidates all the logic AMDGPU uses for deducing memory types into a single
function.  This will make it much easier to support different ABIs in the future.

Reviewers: arsenm

Subscribers: arsenm, wdng, nhaehnle, llvm-commits, yaxunl

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

llvm-svn: 281781

8 years agoAMDGPU: Use SOPK compare instructions
Matt Arsenault [Fri, 16 Sep 2016 21:41:16 +0000 (21:41 +0000)]
AMDGPU: Use SOPK compare instructions

llvm-svn: 281780

8 years agoAMDGPU/SI: Add support for triples with the mesa3d operating system
Tom Stellard [Fri, 16 Sep 2016 21:34:26 +0000 (21:34 +0000)]
AMDGPU/SI: Add support for triples with the mesa3d operating system

Summary:
mesa3d will use the same kernel calling convention as amdhsa, but it will
handle everything else like the default 'unknown' OS type.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits, kzhuravl

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

llvm-svn: 281779

8 years agoPut SHF_ALLOC sections first, even with linker scripts.
Rafael Espindola [Fri, 16 Sep 2016 21:29:07 +0000 (21:29 +0000)]
Put SHF_ALLOC sections first, even with linker scripts.

This matches gold and bfd, and is pretty much required by some linker
scripts. They end with commands like

foo   0 : { *(bar) }

if we put any SHF_ALLOC sections after they can have an address that
is too low.

llvm-svn: 281778