platform/upstream/llvm.git
8 years ago[mips] MSA intrinsics header file
Simon Dardis [Tue, 20 Sep 2016 15:07:36 +0000 (15:07 +0000)]
[mips] MSA intrinsics header file

This patch adds the msa.h header file containing the shorter names for the
MSA instrinsics, e.g. msa_sll_b for builtin_msa_sll_b.

Reviewers: vkalintiris, zoran.jovanovic

Differential Review: https://reviews.llvm.org/D24674

llvm-svn: 281975

8 years agoMove test to the correct directory. NFC.
Rafael Espindola [Tue, 20 Sep 2016 14:49:18 +0000 (14:49 +0000)]
Move test to the correct directory. NFC.

llvm-svn: 281974

8 years ago[X86][SSE] Regenerate multiple combine tests
Simon Pilgrim [Tue, 20 Sep 2016 14:42:45 +0000 (14:42 +0000)]
[X86][SSE] Regenerate multiple combine tests

llvm-svn: 281973

8 years agomove variables closer to their uses; add FIXMEs; NFC
Sanjay Patel [Tue, 20 Sep 2016 14:36:14 +0000 (14:36 +0000)]
move variables closer to their uses; add FIXMEs; NFC

llvm-svn: 281972

8 years ago[XRay] ARM 32-bit no-Thumb support in compiler-rt
Dean Michael Berris [Tue, 20 Sep 2016 14:35:57 +0000 (14:35 +0000)]
[XRay] ARM 32-bit no-Thumb support in compiler-rt

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

https://reviews.llvm.org/D23931 (LLVM)
https://reviews.llvm.org/D23932 (Clang test)

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

llvm-svn: 281971

8 years agotsan: check more addresses in CheckShadowMapping
Dmitry Vyukov [Tue, 20 Sep 2016 13:30:01 +0000 (13:30 +0000)]
tsan: check more addresses in CheckShadowMapping

There is still a handful of them, so should not slow down
tsan apps. But gives assurance if we change/complicate
shadow mappings.

llvm-svn: 281970

8 years agotsan: make CHECK more robust
Dmitry Vyukov [Tue, 20 Sep 2016 13:28:20 +0000 (13:28 +0000)]
tsan: make CHECK more robust

Enable more ignores when we start crashing.
Unwind in CHECK SIGSEGVs if happens early:

FATAL: ThreadSanitizer CHECK failed: ../projects/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cc:105 "((beg)) <= ((end))" (0x8000000000, 0x4000000000)
Program received signal SIGSEGV, Segmentation fault.
__tsan::MetaMap::GetAndLock (this=0x1337c88 <__tsan::ctx_placeholder+8>, thr=thr@entry=0x7ffff7f91800, pc=pc@entry=4639488, addr=addr@entry=140737339086992, write_lock=write_lock@entry=true,
    create=create@entry=true) at ../projects/compiler-rt/lib/tsan/rtl/tsan_sync.cc:208
208   u32 idx0 = *meta;
(gdb) bt
#0  __tsan::MetaMap::GetAndLock (this=0x1337c88 <__tsan::ctx_placeholder+8>, thr=thr@entry=0x7ffff7f91800, pc=pc@entry=4639488, addr=addr@entry=140737339086992, write_lock=write_lock@entry=true,
    create=create@entry=true) at ../projects/compiler-rt/lib/tsan/rtl/tsan_sync.cc:208
#1  0x00000000004a965f in __tsan::MetaMap::GetOrCreateAndLock (this=<optimized out>, thr=thr@entry=0x7ffff7f91800, pc=pc@entry=4639488, addr=addr@entry=140737339086992, write_lock=write_lock@entry=true)
    at ../projects/compiler-rt/lib/tsan/rtl/tsan_sync.cc:198
#2  0x00000000004a162a in __tsan::Release (thr=0x7ffff7f91800, pc=pc@entry=4639488, addr=addr@entry=140737339086992) at ../projects/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc:395
#3  0x000000000046cc40 in __interceptor_pthread_once (o=0x7ffff71a5890 <once_regsizes>, f=0x7ffff6f9d9c0 <init_dwarf_reg_size_table>) at ../projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:1334
#4  0x00007ffff6f9fe86 in __gthread_once (__func=0x7ffff6f9d9c0 <init_dwarf_reg_size_table>, __once=0x7ffff71a5890 <once_regsizes>) at ./gthr-default.h:699
#5  uw_init_context_1 (context=context@entry=0x7fffffffd6d0, outer_cfa=outer_cfa@entry=0x7fffffffd980, outer_ra=0x437d13 <__sanitizer::BufferedStackTrace::SlowUnwindStack(unsigned long, unsigned int)+67>)
    at ../../../src/libgcc/unwind-dw2.c:1572
#6  0x00007ffff6fa06a8 in _Unwind_Backtrace (trace=0x437c30 <__sanitizer::Unwind_Trace(_Unwind_Context*, void*)>, trace_argument=0x7fffffffd980) at ../../../src/libgcc/unwind.inc:283
#7  0x0000000000437d13 in __sanitizer::BufferedStackTrace::SlowUnwindStack (this=0x7ffff6103208, pc=pc@entry=4863574, max_depth=max_depth@entry=256)
    at ../projects/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:125
#8  0x0000000000434f4a in __sanitizer::BufferedStackTrace::Unwind (this=this@entry=0x7ffff6103208, max_depth=max_depth@entry=256, pc=pc@entry=4863574, bp=bp@entry=0, context=context@entry=0x0,
    stack_top=stack_top@entry=0, stack_bottom=stack_bottom@entry=0, request_fast_unwind=request_fast_unwind@entry=false) at ../projects/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc:76
#9  0x00000000004a36b3 in PrintCurrentStackSlow (pc=4863574) at ../projects/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cc:696
#10 __tsan::TsanCheckFailed (file=<optimized out>, line=<optimized out>, cond=<optimized out>, v1=<optimized out>, v2=<optimized out>) at ../projects/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cc:44
#11 0x000000000042dfd6 in __sanitizer::CheckFailed (file=file@entry=0x4b9fd0 "../projects/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cc", line=line@entry=105,
    cond=cond@entry=0x4ba049 "((beg)) <= ((end))", v1=v1@entry=549755813888, v2=v2@entry=274877906944) at ../projects/compiler-rt/lib/sanitizer_common/sanitizer_termination.cc:79
#12 0x00000000004aa36c in ProtectRange (end=274877906944, beg=549755813888) at ../projects/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cc:105
#13 __tsan::CheckAndProtect () at ../projects/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cc:133
#14 0x00000000004a9e95 in __tsan::InitializePlatform () at ../projects/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc:280
#15 0x0000000000497e73 in __tsan::Initialize (thr=0x7ffff7f91800) at ../projects/compiler-rt/lib/tsan/rtl/tsan_rtl.cc:343
#16 0x00007ffff7dea25a in _dl_init (main_map=0x7ffff7ffe1c8, argc=1, argv=0x7fffffffdb88, env=0x7fffffffdb98) at dl-init.c:111
#17 0x00007ffff7ddb30a in _dl_start_user () at rtld.c:871

llvm-svn: 281969

8 years agoRemove empty section commands.
Rafael Espindola [Tue, 20 Sep 2016 13:12:07 +0000 (13:12 +0000)]
Remove empty section commands.

We were already not creating them, and with this other parts of the
code don't have to worry about them.

llvm-svn: 281968

8 years ago[AMDGPU][mc] Add regression tests for Bug 28168
Artem Tamazov [Tue, 20 Sep 2016 11:58:40 +0000 (11:58 +0000)]
[AMDGPU][mc] Add regression tests for Bug 28168

llvm-svn: 281967

8 years agoAVX-512: Fixed a bug in lowering saturated operations on KNL.
Elena Demikhovsky [Tue, 20 Sep 2016 11:02:26 +0000 (11:02 +0000)]
AVX-512: Fixed a bug in lowering saturated operations on KNL.

The generated code is still not optimal.

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

llvm-svn: 281966

8 years ago[AMDGPU] Refactor VOP3 instruction TD definitions
Valery Pykhtin [Tue, 20 Sep 2016 10:41:16 +0000 (10:41 +0000)]
[AMDGPU] Refactor VOP3 instruction TD definitions

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

llvm-svn: 281965

8 years agoMake llvm::ConvertDebugDeclareToDebugValue() be a void function (NFC)
Keith Walker [Tue, 20 Sep 2016 10:36:17 +0000 (10:36 +0000)]
Make llvm::ConvertDebugDeclareToDebugValue() be a void function (NFC)

The routines llvm::ConvertDebugDeclareToDebugValue() always returned
a true value which was never checked at the call site; change the
function return type to void.

This NFC cleanup was approved in the review https://reviews.llvm.org/D23715

llvm-svn: 281964

8 years agoAMDGPU: Improve documentation.
Nikolay Haustov [Tue, 20 Sep 2016 09:04:51 +0000 (09:04 +0000)]
AMDGPU: Improve documentation.

Summary:
Add links to ISA manuals and ABI.
Add text about assembler syntax.
Add info about instructions operands.
Add instruction examples for each encoding.
Update directives section, add missing .amdgpu_hsa_kernel.

Reviewers: tstellarAMD, SamWot, vpykhtin

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, tony-tye, artem.tamazov, llvm-commits

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

llvm-svn: 281962

8 years agoReverting revision 281960 due to test failures.
Dorit Nuzman [Tue, 20 Sep 2016 08:27:48 +0000 (08:27 +0000)]
Reverting revision 281960 due to test failures.

llvm-svn: 281961

8 years ago[SROA] Preserve llvm.mem.parallel_loop_access metadata.
Dorit Nuzman [Tue, 20 Sep 2016 07:50:49 +0000 (07:50 +0000)]
[SROA] Preserve llvm.mem.parallel_loop_access metadata.

SROA doesn't preserve the llvm.mem.parallel_loop_access metadata when it
transforms loads/stores. This patch fixes a couple occurences of this
issue.

(Partially addresses PR28981).

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

llvm-svn: 281960

8 years ago[AVX-512] Teach X86InstrInfo::copyPhysReg to use a 512-bit move if XMM16-XMM31 or...
Craig Topper [Tue, 20 Sep 2016 06:49:17 +0000 (06:49 +0000)]
[AVX-512] Teach X86InstrInfo::copyPhysReg to use a 512-bit move if XMM16-XMM31 or YMM16-YMM31 are the source or dest of the copy and VLX is not supported.

This can happen with SUBREG_TO_REG of ZMM16-ZMM31. Fixes PR30430.

llvm-svn: 281959

8 years ago[AVX-512] Use 512-bit vcvtps2ph/vcvtph2ps to implement fp_to_f16/f16_to_fp when F16C...
Craig Topper [Tue, 20 Sep 2016 05:44:47 +0000 (05:44 +0000)]
[AVX-512] Use 512-bit vcvtps2ph/vcvtph2ps to implement fp_to_f16/f16_to_fp when F16C and VLX are not supported.

Fixes PR23941.

llvm-svn: 281958

8 years agoBranchFolder: Fix invalid undef flags after merge.
Matthias Braun [Tue, 20 Sep 2016 01:14:42 +0000 (01:14 +0000)]
BranchFolder: Fix invalid undef flags after merge.

It is legal to merge instructions with different undef flags; However we
must drop the undef flag from the merged instruction if it isn't present
everywhere.

This fixes http://llvm.org/PR30199

llvm-svn: 281957

8 years agoMachine{Instr|Operand}: Clarify some isIdenticalTo() subtleties.
Matthias Braun [Tue, 20 Sep 2016 01:14:39 +0000 (01:14 +0000)]
Machine{Instr|Operand}: Clarify some isIdenticalTo() subtleties.

llvm-svn: 281956

8 years ago[RegisterBankInfo] Avoid heap allocation in InstructionMapping.
Quentin Colombet [Tue, 20 Sep 2016 00:48:44 +0000 (00:48 +0000)]
[RegisterBankInfo] Avoid heap allocation in InstructionMapping.

Use SmallVector instead of dynamically allocated arrays for the mapping of the
operands in the InstructionMapping. That way we avoid heap allocation for most
of the cases. Ultimately, we should not have to rely on such tricky, the
instances of InstructionMapping would be TableGen'ed.

This improves the compilation time of the RegBankSelect pass.

llvm-svn: 281955

8 years agoclang-change-namespace: Update libdeps.
NAKAMURA Takumi [Tue, 20 Sep 2016 00:44:45 +0000 (00:44 +0000)]
clang-change-namespace: Update libdeps.

FIXME: It seems clangFormat is not referred.
llvm-svn: 281954

8 years ago[x86] fix variable names; NFC
Sanjay Patel [Tue, 20 Sep 2016 00:27:22 +0000 (00:27 +0000)]
[x86] fix variable names; NFC

llvm-svn: 281953

8 years ago[sanitizer-coverage] add comdat to coverage guards if needed
Kostya Serebryany [Tue, 20 Sep 2016 00:16:54 +0000 (00:16 +0000)]
[sanitizer-coverage] add comdat to coverage guards if needed

llvm-svn: 281952

8 years agoRemove a use of std::list.
Rui Ueyama [Tue, 20 Sep 2016 00:02:06 +0000 (00:02 +0000)]
Remove a use of std::list.

llvm-svn: 281951

8 years ago[x86] auto-generate checks
Sanjay Patel [Mon, 19 Sep 2016 23:44:50 +0000 (23:44 +0000)]
[x86] auto-generate checks

llvm-svn: 281950

8 years ago[LCSSA] Cache LoopExits to avoid wasted work
Philip Reames [Mon, 19 Sep 2016 23:30:23 +0000 (23:30 +0000)]
[LCSSA] Cache LoopExits to avoid wasted work

When looking at the scribus_1.3 example from https://llvm.org/bugs/show_bug.cgi?id=10584, I noticed that we were spending a large amount of time computing loop exits in LCSSA. This code appears to be written with the assumption that LoopExits are stored in the Loop and thus cheap to query. This is not true, so we should cache the result across the potentially long running loop which tends to visit a small handful of Loops.

On the particular example from 10584, this change drops the time spent in LCSSA computation by about 80%.

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

llvm-svn: 281949

8 years ago[RegisterBankInfo] Adapt call to std::fill due to use of SmallVector.
Quentin Colombet [Mon, 19 Sep 2016 23:18:47 +0000 (23:18 +0000)]
[RegisterBankInfo] Adapt call to std::fill due to use of SmallVector.

This was meant to be commited with my previous commit.

llvm-svn: 281948

8 years agoMerge branch 'ADCE5'
David Callahan [Mon, 19 Sep 2016 23:17:58 +0000 (23:17 +0000)]
Merge branch 'ADCE5'

llvm-svn: 281947

8 years ago[GC] Don't crash when printing the special Discarded GC section.
Davide Italiano [Mon, 19 Sep 2016 23:15:51 +0000 (23:15 +0000)]
[GC] Don't crash when printing the special Discarded GC section.

InputSection<ELFT>::Discarded has no name and it's not backed by
a file. Trying to report it as discared will cause a nullptr
dereference, therefore a crash. Skip it.

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

llvm-svn: 281946

8 years ago[Kaleidoscope] Make Chapter 2 use llvm::make_unique, rather than a helper.
Lang Hames [Mon, 19 Sep 2016 23:00:27 +0000 (23:00 +0000)]
[Kaleidoscope] Make Chapter 2 use llvm::make_unique, rather than a helper.

This essentially reverts r251936, minimizing the difference between Chapter2
and Chapter 3, and making Chapter 2's code match the tutorial text.

llvm-svn: 281945

8 years ago[x86] use getSignBit() to simplify code; NFCI
Sanjay Patel [Mon, 19 Sep 2016 22:07:27 +0000 (22:07 +0000)]
[x86] use getSignBit() to simplify code; NFCI

llvm-svn: 281944

8 years agoFixed the build by changing a couple of const char *s to StringRefs.
Sean Callanan [Mon, 19 Sep 2016 22:06:12 +0000 (22:06 +0000)]
Fixed the build by changing a couple of const char *s to StringRefs.

llvm-svn: 281943

8 years agoConvert 3 more functions to use a StringRef.
Zachary Turner [Mon, 19 Sep 2016 21:56:59 +0000 (21:56 +0000)]
Convert 3 more functions to use a StringRef.

This converts Args::Unshift, Args::AddOrReplaceEnvironmentVariable,
and Args::ContainsEnvironmentVariable to use StringRefs.  The code
is also simplified somewhat as a result.

llvm-svn: 281942

8 years agoMove the armv8.1-a ras test to a negative with noras test as ras is
Eric Christopher [Mon, 19 Sep 2016 21:55:04 +0000 (21:55 +0000)]
Move the armv8.1-a ras test to a negative with noras test as ras is
included in armv8.1-a by default and so we weren't testing anything.

llvm-svn: 281941

8 years agoBitcodeWriter: fix emission of invoke when calling a var-arg function with operand...
Mehdi Amini [Mon, 19 Sep 2016 21:27:04 +0000 (21:27 +0000)]
BitcodeWriter: fix emission of invoke when calling a var-arg function with operand bundles

llvm-svn: 281940

8 years agoMisleading comments of SplitBlockAndInsertIfThenElse in BasicBlockUtils.h
Evgeniy Stepanov [Mon, 19 Sep 2016 21:26:05 +0000 (21:26 +0000)]
Misleading comments of SplitBlockAndInsertIfThenElse in BasicBlockUtils.h

The comments of SplitBlockAndInsertIfThenElse say the SplitBefore instruction will stay in the old block.
But according to the implementation(split the block at SplitBefore by using splitBasicBlock), the SplitBefore will be moved to the new block.

This patch fixes the comments.

Patch by Zhe Yu Wu.

llvm-svn: 281939

8 years ago[scudo] Modify Scudo to use its own Secondary Allocator
Kostya Kortchinsky [Mon, 19 Sep 2016 21:11:55 +0000 (21:11 +0000)]
[scudo] Modify Scudo to use its own Secondary Allocator

Summary:
The Sanitizer Secondary Allocator was not entirely ideal was Scudo for several
reasons: decent amount of unneeded code, redundant checks already performed by
the front end, unneeded data structures, difficulty to properly protect the
secondary chunks header.

Given that the second allocator is pretty straight forward, Scudo will use its
own, trimming all the unneeded code off of the Sanitizer one. A significant
difference in terms of security is that now each secondary chunk is preceded
and followed by a guard page, thus mitigating overflows into and from the
chunk.

A test was added as well to illustrate the overflow & underflow situations
into the guard pages.

Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 281938

8 years ago[X86][SSE] Updated vector abs tests
Simon Pilgrim [Mon, 19 Sep 2016 20:50:35 +0000 (20:50 +0000)]
[X86][SSE] Updated vector abs tests

Renamed and added v2i64 / v4i64 tests

llvm-svn: 281937

8 years agoFix signatures of fallback tow(upper|lower)_l.
Dan Albert [Mon, 19 Sep 2016 20:42:57 +0000 (20:42 +0000)]
Fix signatures of fallback tow(upper|lower)_l.

Summary:
These functions take and return wint_t, not int:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/towupper.html

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 281936

8 years agoAdd missing dependency to change-namespace.
Eric Liu [Mon, 19 Sep 2016 20:41:39 +0000 (20:41 +0000)]
Add missing dependency to change-namespace.

llvm-svn: 281935

8 years ago[analyzer] Calculate extent size for memory regions allocated by new expression.
Gabor Horvath [Mon, 19 Sep 2016 20:39:52 +0000 (20:39 +0000)]
[analyzer] Calculate extent size for memory regions allocated by new expression.

ArrayBoundChecker did not detect out of bounds memory access errors in case an
array was allocated by the new expression. This patch resolves this issue.

Patch by Daniel Krupp!

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

llvm-svn: 281934

8 years ago[libFuzzer] use sleep() instead of std::this_thread::sleep_for to avoid coverage...
Kostya Serebryany [Mon, 19 Sep 2016 20:32:34 +0000 (20:32 +0000)]
[libFuzzer] use sleep() instead of  std::this_thread::sleep_for to  avoid coverage from instrumented libc++

llvm-svn: 281933

8 years agoUse FileCheck variables. NFC.
Rafael Espindola [Mon, 19 Sep 2016 20:23:19 +0000 (20:23 +0000)]
Use FileCheck variables. NFC.

llvm-svn: 281932

8 years agoMap .data.rel.ro correctly.
Rafael Espindola [Mon, 19 Sep 2016 19:59:21 +0000 (19:59 +0000)]
Map .data.rel.ro correctly.

An input section named .data.rel.ro now maps to an output section
named .data.rel.ro. Before we were mapping it to .data.

llvm-svn: 281931

8 years agoMake this test a bit stricter.
Rafael Espindola [Mon, 19 Sep 2016 19:56:51 +0000 (19:56 +0000)]
Make this test a bit stricter.

By making every section on byte and checking the size it now shows how
many sections were concatenated into each output section.

llvm-svn: 281930

8 years agoDon't CHECK the addresses. NFC
Rafael Espindola [Mon, 19 Sep 2016 18:58:30 +0000 (18:58 +0000)]
Don't CHECK the addresses. NFC

That is not what this test is about. This reduces changes in another
patch that changes layout.

llvm-svn: 281929

8 years agoHandle early inline for hot callsites that reside in the same basic block.
Dehao Chen [Mon, 19 Sep 2016 18:38:14 +0000 (18:38 +0000)]
Handle early inline for hot callsites that reside in the same basic block.

Summary: Callsites in the same basic block should share the same hotness. This patch checks for the hottest callsite in the same basic block, and use the hotness for all callsites in that basic block for early inline decisions. It also fixes the test to add "-S" so theat the "CHECK-NOT" is actually checking the content.

Reviewers: dnovillo

Subscribers: llvm-commits

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

llvm-svn: 281927

8 years agoFix compilation of unit tests.
Zachary Turner [Mon, 19 Sep 2016 18:32:23 +0000 (18:32 +0000)]
Fix compilation of unit tests.

llvm-svn: 281926

8 years ago[libc++] Fix extern template visibility for Windows
Shoaib Meenai [Mon, 19 Sep 2016 18:29:07 +0000 (18:29 +0000)]
[libc++] Fix extern template visibility for Windows

On Windows, marking an `extern template class` declaration as exported
actually forces an instantiation, which is not the desired behavior.
Instead, the actual explicit instantiations need to be exported.

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

llvm-svn: 281925

8 years agoReorder initializers in CallStackFrame so that we don't get a warning.
Samuel Antao [Mon, 19 Sep 2016 18:13:13 +0000 (18:13 +0000)]
Reorder initializers in CallStackFrame so that we don't get a warning.

llvm-svn: 281923

8 years agoTry to fix freebsd and android builds.
Zachary Turner [Mon, 19 Sep 2016 18:03:54 +0000 (18:03 +0000)]
Try to fix freebsd and android builds.

llvm-svn: 281922

8 years agoReplace __ANDROID__ with __BIONIC__.
Dan Albert [Mon, 19 Sep 2016 18:00:45 +0000 (18:00 +0000)]
Replace __ANDROID__ with __BIONIC__.

Summary:
None of these checks are specific to Android devices. If libc++ was
used with Bionic on a normal Linux system these checks would still be
needed.

Reviewers: mclow.lists, EricWF

Subscribers: compnerd, tberghammer, danalbert, srhines, cfe-commits

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

llvm-svn: 281921

8 years agoTrying to fix name conflict in change-namespace tool.
Eric Liu [Mon, 19 Sep 2016 17:58:59 +0000 (17:58 +0000)]
Trying to fix name conflict in change-namespace tool.

llvm-svn: 281920

8 years agoFix more functions in Args to use StringRef.
Zachary Turner [Mon, 19 Sep 2016 17:54:06 +0000 (17:54 +0000)]
Fix more functions in Args to use StringRef.

This patch also marks the const char* versions as =delete to prevent
their use.  This has the potential to cause build breakages on some
platforms which I can't compile.  I have tested on Windows, Linux,
and OSX.  Best practices for fixing broken callsites are outlined in
Args.h in a comment above the deleted function declarations.

Eventually we can remove these =delete declarations, but for now they
are important to make sure that all implicit conversions from
const char * are manually audited to make sure that they do not invoke a
conversion from nullptr.

llvm-svn: 281919

8 years agoA clang tool for changing surrouding namespaces of class/function definitions.
Eric Liu [Mon, 19 Sep 2016 17:40:32 +0000 (17:40 +0000)]
A clang tool for changing surrouding namespaces of class/function definitions.

Summary:
A tool for changing surrouding namespaces of class/function definitions while keeping
references to types in the changed namespace correctly qualified by prepending
namespace specifiers before them.

Example: test.cc
   namespace na {
   class X {};
   namespace nb {
   class Y { X x; };
   } // namespace nb
   } // namespace na

To move the definition of class Y from namespace "na::nb" to "x::y", run:
   clang-change-namespace --old_namespace "na::nb" \
     --new_namespace "x::y" --file_pattern "test.cc" test.cc --

Output:
   namespace na {
   class X {};
   } // namespace na
   namespace x {
   namespace y {
   class Y { na::X x; };
   } // namespace y
   } // namespace x

Reviewers: alexfh, omtcyfz, hokein

Subscribers: mgorny, klimek, djasper, beanz, alexshap, Eugene.Zelenko, cfe-commits

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

llvm-svn: 281918

8 years ago[Writer] Rename variables to reflect reality. NFCI.
Davide Italiano [Mon, 19 Sep 2016 17:38:39 +0000 (17:38 +0000)]
[Writer] Rename variables to reflect reality. NFCI.

The InputSection variables in the Writer were named `C`. This
was because when the ELF linker was ported (from COFF)
the name `Chunks` for input sections was retained.
Luckily we switched to a more ELF-compliant jargon, but these
variables weren't reanamed accordingly during the transition.

llvm-svn: 281917

8 years ago[RegisterBankInfo] Avoid heap allocation in most cases.
Quentin Colombet [Mon, 19 Sep 2016 17:33:55 +0000 (17:33 +0000)]
[RegisterBankInfo] Avoid heap allocation in most cases.

The OperandsMapper class is used heavy in RegBankSelect and each
instantiation triggered a heap allocation for the array of operands.
Instead, use a SmallVector with a big enough size such that most of the
cases do not have to use dynamically allocated memory.

This improves the compile time of the RegBankSelect pass.

llvm-svn: 281916

8 years ago[OpenCL] Allow half type kernel argument when cl_khr_fp16 is enabled
Yaxun Liu [Mon, 19 Sep 2016 17:11:22 +0000 (17:11 +0000)]
[OpenCL] Allow half type kernel argument when cl_khr_fp16 is enabled

llvm-svn: 281915

8 years agoLiveRangeCalc: Fix reporting of invalid vreg usage in liveness calculation
Matthias Braun [Mon, 19 Sep 2016 16:49:45 +0000 (16:49 +0000)]
LiveRangeCalc: Fix reporting of invalid vreg usage in liveness calculation

Machine programs need a definition of each vreg before reaching a use
(the definition may come from an IMPLICIT_DEF instruction). This class
of errors is not detected by the MachineVerifier because of efficiency
concerns. LiveRangeCalc used to report these problems, make it do that
again (followup to r279625).

Also use report_fatal_error() instead of llvm_unreachable() as the error
reporting is only present in asserts build anyway.

llvm-svn: 281914

8 years agoXcode: support gtests that use the Inputs dir
Todd Fiala [Mon, 19 Sep 2016 16:42:41 +0000 (16:42 +0000)]
Xcode: support gtests that use the Inputs dir

This change adds support for the gtests that require input data
in the Inputs files.  This is done through a new Xcode script
phase that runs the scripts/Xcode/prepare-gtest-run-dir.sh script.
That script simply copies the contents of all unittests/**/Inputs
dirs into ${TARGET_BUILD_DIR}/Inputs before running the test.

This change also renames the Xcode 'gtest-for-debugging' to
'gtest-build', and makes the gtest "build and run" target
depend on gtest-build.  This reduces replication within the
targets.  gtest .c/.cpp files now should only be added to
the gtest-build target.

llvm-svn: 281913

8 years agoOnly set branch weight during sample pgo annotation when max_weight of the branch...
Dehao Chen [Mon, 19 Sep 2016 16:33:41 +0000 (16:33 +0000)]
Only set branch weight during sample pgo annotation when max_weight of the branch is non-zero. Otherwise use default static profile to set branch probability.

Summary: It does not make sense to set equal weights for all unkown branches as we have static branch prediction available.

Reviewers: dnovillo

Subscribers: llvm-commits

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

llvm-svn: 281912

8 years agoUse call target count to derive the call instruction weight
Dehao Chen [Mon, 19 Sep 2016 16:06:37 +0000 (16:06 +0000)]
Use call target count to derive the call instruction weight

Summary: The call target count profile is directly derived from LBR branch->target data. This is more reliable than instruction frequency profiles that could be moved across basic block boundaries. This patches uses call target count profile to annotate call instructions.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

llvm-svn: 281911

8 years agoRemove InstructionCombining and its related pass from sample pgo passes as we can...
Dehao Chen [Mon, 19 Sep 2016 16:02:52 +0000 (16:02 +0000)]
Remove InstructionCombining and its related pass from sample pgo passes as we can handle "invoke" correctly.

Summary: We previously relies on InstructionCombining pass to remove invoke instructions. Now that we can inline invoke instructions correctly, we do not need these passes any more.

Reviewers: dnovillo

Subscribers: llvm-commits

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

llvm-svn: 281910

8 years ago[compiler-rt] Add support for the dynamic shadow allocation
Etienne Bergeron [Mon, 19 Sep 2016 15:59:01 +0000 (15:59 +0000)]
[compiler-rt] Add support for the dynamic shadow allocation

Summary:
This patch is adding the needed code to compiler-rt to support
dynamic shadow.

This is to support this patch:
  https://reviews.llvm.org/D23354

It's adding support for using a shadow placed at a dynamic address determined
at runtime.

The dynamic shadow is required to work on windows 64-bits.

Reviewers: rnk, kcc, vitalybuka

Subscribers: kubabrecka, dberris, llvm-commits, chrisha

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

llvm-svn: 281909

8 years ago[asan] Support dynamic shadow address instrumentation
Etienne Bergeron [Mon, 19 Sep 2016 15:58:38 +0000 (15:58 +0000)]
[asan] Support dynamic shadow address instrumentation

Summary:
This patch is adding the support for a shadow memory with
dynamically allocated address range.

The compiler-rt needs to export a symbol containing the shadow
memory range.

This is required to support ASAN on windows 64-bits.

Reviewers: kcc, rnk, vitalybuka

Subscribers: kubabrecka, dberris, llvm-commits, chrisha

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

llvm-svn: 281908

8 years agoRemove excessive padding from the struct CallStackFrame
Alexander Shaposhnikov [Mon, 19 Sep 2016 15:57:29 +0000 (15:57 +0000)]
Remove excessive padding from the struct CallStackFrame

The struct CallStackFrame is in lib/AST/ExprConstant.cpp
inside anonymous namespace.
This diff reorders the fields and removes excessive padding.
Test plan: make -j8 check-clang

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

llvm-svn: 281907

8 years ago[Support] Add StringRef::withNullAsEmpty()
Zachary Turner [Mon, 19 Sep 2016 15:34:51 +0000 (15:34 +0000)]
[Support] Add StringRef::withNullAsEmpty()

When porting large bodies of code from using const char*
to StringRef, it is helpful to be able to treat nullptr
as an empty string, since that it is often what it is used
to indicate in C-style code.

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

llvm-svn: 281906

8 years agoRevert r281841, it does not work on Windows (PR30443).
Nico Weber [Mon, 19 Sep 2016 15:22:04 +0000 (15:22 +0000)]
Revert r281841, it does not work on Windows (PR30443).

llvm-svn: 281905

8 years ago[OpenCL] Diagnose assignment to dereference of half type pointer
Yaxun Liu [Mon, 19 Sep 2016 14:54:41 +0000 (14:54 +0000)]
[OpenCL] Diagnose assignment to dereference of half type pointer

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

llvm-svn: 281904

8 years ago[AMDGPU] Refactor VOPC instruction TD definitions
Valery Pykhtin [Mon, 19 Sep 2016 14:39:49 +0000 (14:39 +0000)]
[AMDGPU] Refactor VOPC instruction TD definitions

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

llvm-svn: 281903

8 years ago[sanitizer] rename __sanitizer_symbolize_data to __sanitizer_symbolize_global (to...
Kostya Serebryany [Mon, 19 Sep 2016 14:18:16 +0000 (14:18 +0000)]
[sanitizer] rename __sanitizer_symbolize_data to __sanitizer_symbolize_global (to avoid conflict with another definition)

llvm-svn: 281902

8 years agoRemove unnecessary const_canst. NFC.
Rafael Espindola [Mon, 19 Sep 2016 13:33:38 +0000 (13:33 +0000)]
Remove unnecessary const_canst. NFC.

llvm-svn: 281901

8 years ago[ELF] - LinkerScript: Add workaround for gcc 6.2.0 failure w/auto
George Rimar [Mon, 19 Sep 2016 13:27:31 +0000 (13:27 +0000)]
[ELF] - LinkerScript: Add workaround for gcc 6.2.0 failure w/auto

Will Dietz found and reported that lld does not compile with gcc 6.2.0,
more details https://llvm.org/bugs/show_bug.cgi?id=30438

And confirmed this change fixes the issue.

llvm-svn: 281900

8 years agoReverting r281714 due to causing an assert when calling builtins that expect a double...
Neil Hickey [Mon, 19 Sep 2016 11:42:14 +0000 (11:42 +0000)]
Reverting r281714 due to causing an assert when calling builtins that expect a double, from CL

llvm-svn: 281899

8 years ago[AArch64] Fix encoding for lsl #12 in add/sub immediates
Diana Picus [Mon, 19 Sep 2016 11:10:18 +0000 (11:10 +0000)]
[AArch64] Fix encoding for lsl #12 in add/sub immediates

Whenever an add/sub immediate needs a fixup, we set that immediate field to zero,
which is correct, but we also set the shift bits to zero, which is not true for
instructions that use lsl #12. This patch makes sure that if lsl #12 was used,
it will appear in the encoding of the instruction.

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

llvm-svn: 281898

8 years agoFix spelling in CMakeLists
Tobias Grosser [Mon, 19 Sep 2016 10:55:31 +0000 (10:55 +0000)]
Fix spelling in CMakeLists

llvm-svn: 281897

8 years ago[AMDGPU] Fix s_branch with -1 offset
Sam Kolton [Mon, 19 Sep 2016 10:20:55 +0000 (10:20 +0000)]
[AMDGPU] Fix s_branch with -1 offset

Summary:
In case s_branch instruction target is itself backend should emit offset -1 but instead it emit 0.
'''
label:
    s_branch label  // should emit [0xff,0xff,0x82,0xbf]
'''

Tom, Matt: why are we adjusting fixup values in applyFixup() method instead of processFixup()? processFixup() is calling adjustFixupValue() but does nothing with its result.

Reviewers: vpykhtin, artem.tamazov, tstellarAMD

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl

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

llvm-svn: 281896

8 years agoAdd @llvm.dbg.value entries for the phi node created by -mem2reg
Keith Walker [Mon, 19 Sep 2016 09:49:30 +0000 (09:49 +0000)]
Add @llvm.dbg.value entries for the phi node created by -mem2reg

When phi nodes are created in the -mem2reg phase, the @llvm.dbg.declare
entries are converted to @llvm.dbg.value entries at the place where the
store instructions existed. However no entry is created to describe
the resulting value of the phi node.

The effect of this is especially noticeable in for loops which have a
constant for the intial value; the loop control variable's location
would be described as the intial constant value in the loop body once
the -mem2reg optimization phase was run.

This change adds the creation of the @llvm.dbg.value entries to describe
variables whose location is the result of a phi node created in -mem2reg.

Also when the phi node is finally lowered to a machine instruction it
is important that the lowered "load" instruction is placed before the
associated DEBUG_VALUE entry describing the value loaded.

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

llvm-svn: 281895

8 years ago[Thumb] Set correct initial mapping symbol for big-endian thumb
Oliver Stannard [Mon, 19 Sep 2016 09:21:45 +0000 (09:21 +0000)]
[Thumb] Set correct initial mapping symbol for big-endian thumb

The initial mapping symbol state is set from the triple, but we only checked
for the little-endian thumb triple, so could end up with an ARM mapping symbol
for big-endian thumb.

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

llvm-svn: 281894

8 years agoARM: check alignment before transforming ldr -> ldm (or similar).
Tim Northover [Mon, 19 Sep 2016 09:11:09 +0000 (09:11 +0000)]
ARM: check alignment before transforming ldr -> ldm (or similar).

ldm and stm instructions always require 4-byte alignment on the pointer, but we
weren't checking this before trying to reduce code-size by replacing a
post-indexed load/store with them. Unfortunately, we were also dropping this
incormation in DAG ISel too, but that's easy enough to fix.

llvm-svn: 281893

8 years ago[X86 Codegen Test] Divided masked_memop into several files. NFC.
Elena Demikhovsky [Mon, 19 Sep 2016 08:58:43 +0000 (08:58 +0000)]
[X86 Codegen Test] Divided masked_memop into several files. NFC.

The masked_memop.ll became huge. I extracted AVX-512 specific tests into separate files.

llvm-svn: 281892

8 years agoRecommit r281457 "Supports adding insertion around non-insertion replacements".
Eric Liu [Mon, 19 Sep 2016 08:40:42 +0000 (08:40 +0000)]
Recommit r281457 "Supports adding insertion around non-insertion replacements".

Summary:
Diff to r281457:
- added a test case `CalculateRangesOfInsertionAroundReplacement`.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 281891

8 years ago[SimplifyCFG] Update (AND) IR flags when CSE'ing instructions
James Molloy [Mon, 19 Sep 2016 08:23:08 +0000 (08:23 +0000)]
[SimplifyCFG] Update (AND) IR flags when CSE'ing instructions

We were updating metadata but not IR flags. Because we pick an arbitrary instruction to be the CSE candidate, it comes down to luck (50% or less chance) if this results in broken codegen or not, which is why PR30373 which is actually not the fault of the commit it was bisected down to.

Fixes PR30373.

llvm-svn: 281889

8 years agoclang-format: [JS] Fix line breaks before comments when sorting imports.
Martin Probst [Mon, 19 Sep 2016 07:02:34 +0000 (07:02 +0000)]
clang-format: [JS] Fix line breaks before comments when sorting imports.

Summary:
Previously, clang-format would always insert an additional line break after the
import block if the main body started with a comment, due to loosing track of
the first non-import line.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 281888

8 years agoFix respecting LIBOMP_LLVM_LIT_EXECUTABLE as full path
Michal Gorny [Mon, 19 Sep 2016 06:55:56 +0000 (06:55 +0000)]
Fix respecting LIBOMP_LLVM_LIT_EXECUTABLE as full path

Fix lit search to correctly respect LIBOMP_LLVM_LIT_EXECUTABLE as full
program path.

The variable passed to find_program() is created by CMake as a cache
variable, and therefore can be directly overriden by the user. Since
this was the design of LIBOMP_LLVM_LIT_EXECUTABLE (as can be deduced
from the error messages) and there is no other use of LIT_EXECUTABLE,
remove the redundant variable and pass LIBOMP_LLVM_LIT_EXECUTABLE
directly to find_program().

Furthermore, the previous code did not work since the HINTS argument
specifies more search directories rather than expected full path.
Quoting the CMake documentation:

> 3. Search the paths specified by the HINTS option. These should be
> paths computed by system introspection, such as a hint provided by
> the location of another item already found. Hard-coded guesses should
> be specified with the PATHS option.

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

llvm-svn: 281887

8 years ago[sanitizer] add __sanitizer_symbolize_data (can only print the names of the globals...
Kostya Serebryany [Mon, 19 Sep 2016 05:10:32 +0000 (05:10 +0000)]
[sanitizer] add __sanitizer_symbolize_data (can only print the names of the globals for now)

llvm-svn: 281886

8 years ago[X86,AVX-512] Use INSERT_SUBREG instead of SUBREG_TO_REG when the input is not the...
Craig Topper [Mon, 19 Sep 2016 02:53:43 +0000 (02:53 +0000)]
[X86,AVX-512] Use INSERT_SUBREG instead of SUBREG_TO_REG when the input is not the output of an instruction.

SUBREG_TO_REG is supposed to indicate that the super register has been zeroed, but we can't prove that if we don't know where it came from.

llvm-svn: 281885

8 years ago[AVX-512] Add support for lowering fp_to_f16 and f16_to_fp when VLX is supported...
Craig Topper [Mon, 19 Sep 2016 02:53:37 +0000 (02:53 +0000)]
[AVX-512] Add support for lowering fp_to_f16 and f16_to_fp when VLX is supported regardless of whether F16C is also supported.

Still need to add support for lowering using AVX512F when neither VLX or F16C is supported.

llvm-svn: 281884

8 years ago[llvm-cov] Emit a link to some documentation
Vedant Kumar [Mon, 19 Sep 2016 02:15:59 +0000 (02:15 +0000)]
[llvm-cov] Emit a link to some documentation

llvm-svn: 281883

8 years ago[llvm-cov] Delete the NonCodeLines field, it was always dead
Vedant Kumar [Mon, 19 Sep 2016 01:46:01 +0000 (01:46 +0000)]
[llvm-cov] Delete the NonCodeLines field, it was always dead

llvm-svn: 281882

8 years ago[docs] Touch up the code coverage doc
Vedant Kumar [Mon, 19 Sep 2016 01:42:38 +0000 (01:42 +0000)]
[docs] Touch up the code coverage doc

llvm-svn: 281881

8 years ago[analyzer] SATestBuild.py: Treat '#' as comment in projectMap.csv
Devin Coughlin [Mon, 19 Sep 2016 01:36:40 +0000 (01:36 +0000)]
[analyzer] SATestBuild.py: Treat '#' as comment in projectMap.csv

Treat lines in projectMap.csv that start with '#' as comments. This enables a
workflow where projects can be temporarily disabled with a comment describing
when they should be turned back on.

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

llvm-svn: 281880

8 years ago[XRay] ARM 32-bit no-Thumb support in Clang
Dean Michael Berris [Mon, 19 Sep 2016 00:59:19 +0000 (00:59 +0000)]
[XRay] ARM 32-bit no-Thumb support in Clang

Just a test for now, adapted from x86_64 tests of XRay.
This is one of 3 commits to different repositories of XRay ARM port. The other 2 are:

https://reviews.llvm.org/D23931 (LLVM)
https://reviews.llvm.org/D23933 (compiler-rt)

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

llvm-svn: 281879

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