platform/upstream/llvm.git
7 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

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

llvm-svn: 281947

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

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

llvm-svn: 281869

7 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

7 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

7 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

7 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

7 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

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

llvm-svn: 281863

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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