platform/upstream/llvm.git
7 years agoFollow-up for r298738: Use "0" instead of "false" because the variable is uptr.
Kuba Mracek [Fri, 24 Mar 2017 21:12:24 +0000 (21:12 +0000)]
Follow-up for r298738: Use "0" instead of "false" because the variable is uptr.

llvm-svn: 298741

7 years ago[libFuzzer] honor -exact_artifact_path for all intermediate files during crash minimi...
Kostya Serebryany [Fri, 24 Mar 2017 21:09:16 +0000 (21:09 +0000)]
[libFuzzer] honor -exact_artifact_path for all intermediate files during crash minimization (https://github.com/google/oss-fuzz/issues/250)

llvm-svn: 298740

7 years agoMove spill size and alignment info from MC to TargetRegisterInfo
Krzysztof Parzyszek [Fri, 24 Mar 2017 21:01:16 +0000 (21:01 +0000)]
Move spill size and alignment info from MC to TargetRegisterInfo

This is another step towards implementing register classes with
parametrized register/spill sizes and value types.

This is an updated version of r298652. The difference is that MCRegister-
Class still contains register size, available as getPhysRegSize(). The
old function getSize was retained as a temporary measure to avoid build
breakage for out-of-tree targets.

llvm-svn: 298739

7 years agoFix an uninitialized field in tsan_block_context_t/AllocContext in tsan_libdispatch_m...
Kuba Mracek [Fri, 24 Mar 2017 20:57:33 +0000 (20:57 +0000)]
Fix an uninitialized field in tsan_block_context_t/AllocContext in tsan_libdispatch_mac.cc.

llvm-svn: 298738

7 years agoAMDGPU: Fix annotating loops with nested loop conditions
Matt Arsenault [Fri, 24 Mar 2017 20:57:10 +0000 (20:57 +0000)]
AMDGPU: Fix annotating loops with nested loop conditions

If the branch condition for a loop was a phi which itself
was fed from a phi from a loop, it isn't safe to try
to delete the phi until after the loop is handled.

llvm-svn: 298737

7 years ago[MachineScheduler] Add missing machine pass dependency.
Davide Italiano [Fri, 24 Mar 2017 20:52:56 +0000 (20:52 +0000)]
[MachineScheduler] Add missing machine pass dependency.

llvm-svn: 298736

7 years agoRevert r298620: [LV] Vectorize GEPs
Ivan Krasin [Fri, 24 Mar 2017 20:49:43 +0000 (20:49 +0000)]
Revert r298620: [LV] Vectorize GEPs

Reason: breaks linking Chromium with LLD + ThinLTO (a pass crashes)
LLVM bug: https://bugs.llvm.org//show_bug.cgi?id=32413

Original change description:

[LV] Vectorize GEPs

This patch adds support for vectorizing GEPs. Previously, we only generated
vector GEPs on-demand when creating gather or scatter operations. All GEPs from
the original loop were scalarized by default, and if a pointer was to be stored
to memory, we would have to build up the pointer vector with insertelement
instructions.

With this patch, we will vectorize all GEPs that haven't already been marked
for scalarization.

The patch refines collectLoopScalars to more exactly identify the scalar GEPs.
The function now more closely resembles collectLoopUniforms. And the patch
moves vector GEP creation out of vectorizeMemoryInstruction and into the main
vectorization loop. The vector GEPs needed for gather and scatter operations
will have already been generated before vectoring the memory accesses.

Original Differential Revision: https://reviews.llvm.org/D30710

llvm-svn: 298735

7 years ago[Outliner] Remove no red zone requirment for AArch64
Jessica Paquette [Fri, 24 Mar 2017 20:47:59 +0000 (20:47 +0000)]
[Outliner] Remove no red zone requirment for AArch64

AArch64 doesn't require -mno-red-zone; stack fixups are sufficient here. This was
unnecessarily copied over from the X86 target.

(You can now outline with red zones! Yay!)

Removing the requirement passes all Single/MultiSource tests.

llvm-svn: 298734

7 years agoDocument how to fetch monorepo SVN revision notes
Reid Kleckner [Fri, 24 Mar 2017 20:47:41 +0000 (20:47 +0000)]
Document how to fetch monorepo SVN revision notes

llvm-svn: 298733

7 years ago[asan] Delay creation of asan ctor.
Evgeniy Stepanov [Fri, 24 Mar 2017 20:42:15 +0000 (20:42 +0000)]
[asan] Delay creation of asan ctor.

Create the constructor in the module pass.
This in needed for the GC-friendly globals change, where the constructor can be
put in a comdat  in some cases, but we don't know about that in the function
pass.

llvm-svn: 298731

7 years agoAMDGPU: Implement f16 fround
Matt Arsenault [Fri, 24 Mar 2017 20:04:18 +0000 (20:04 +0000)]
AMDGPU: Implement f16 fround

llvm-svn: 298730

7 years agoAMDGPU: Unify divergent function exits.
Matt Arsenault [Fri, 24 Mar 2017 19:52:05 +0000 (19:52 +0000)]
AMDGPU: Unify divergent function exits.

StructurizeCFG can't handle cases with multiple
returns creating regions with multiple exits.
Create a copy of UnifyFunctionExitNodes that only
unifies exit nodes that skips exit nodes
with uniform branch sources.

llvm-svn: 298729

7 years agoFix a test so that it actually checks the output.
Peter Collingbourne [Fri, 24 Mar 2017 19:32:20 +0000 (19:32 +0000)]
Fix a test so that it actually checks the output.

llvm-svn: 298728

7 years agoRevert r298652 on Quentin's request
Krzysztof Parzyszek [Fri, 24 Mar 2017 19:18:29 +0000 (19:18 +0000)]
Revert r298652 on Quentin's request

llvm-svn: 298727

7 years agoMake testcase less nonsensical while still exercising the same code paths.
Adrian Prantl [Fri, 24 Mar 2017 19:11:31 +0000 (19:11 +0000)]
Make testcase less nonsensical while still exercising the same code paths.

llvm-svn: 298726

7 years agoAMDGPU: Fold rcp/rsq of undef to undef
Matt Arsenault [Fri, 24 Mar 2017 19:04:57 +0000 (19:04 +0000)]
AMDGPU: Fold rcp/rsq of undef to undef

llvm-svn: 298725

7 years agoTTI: Split IsSimple in MemIntrinsicInfo
Matt Arsenault [Fri, 24 Mar 2017 18:56:43 +0000 (18:56 +0000)]
TTI: Split IsSimple in MemIntrinsicInfo

All this did before was assert in EarlyCSE.

llvm-svn: 298724

7 years ago[AMDGPU] Fold V_CNDMASK with identical source operands
Stanislav Mekhanoshin [Fri, 24 Mar 2017 18:55:20 +0000 (18:55 +0000)]
[AMDGPU] Fold V_CNDMASK with identical source operands

Such instructions sometimes appear after lowering and folding.

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

llvm-svn: 298723

7 years ago[AMDGPU] Rename Kind to ValueKind in metadata to be consistent
Konstantin Zhuravlyov [Fri, 24 Mar 2017 18:43:15 +0000 (18:43 +0000)]
[AMDGPU] Rename Kind to ValueKind in metadata to be consistent

llvm-svn: 298722

7 years ago[AMDGPU] Add AMDGPUAliasAnalysis to opt pipeline
Stanislav Mekhanoshin [Fri, 24 Mar 2017 18:01:14 +0000 (18:01 +0000)]
[AMDGPU] Add AMDGPUAliasAnalysis to opt pipeline

Previously it was added only to the BE.

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

llvm-svn: 298721

7 years ago[ThinLTO] Correct counting of functions in inliner stats
Teresa Johnson [Fri, 24 Mar 2017 17:59:06 +0000 (17:59 +0000)]
[ThinLTO] Correct counting of functions in inliner stats

Summary: Declarations need to be filtered out when counting functions.

Reviewers: eraman

Subscribers: Prazek, llvm-commits

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

llvm-svn: 298720

7 years ago[AMDGPU] Don't enforce constexpr, there are still old standard libraries around that...
Benjamin Kramer [Fri, 24 Mar 2017 17:53:06 +0000 (17:53 +0000)]
[AMDGPU] Don't enforce constexpr, there are still old standard libraries around that don't have a constexpr std::pair.

llvm-svn: 298719

7 years ago[AMDGPU] Remove double map lookups in SI scheduler
Valery Pykhtin [Fri, 24 Mar 2017 17:49:05 +0000 (17:49 +0000)]
[AMDGPU] Remove double map lookups in SI scheduler

Patch by Axel Davy (axel.davy@normalesup.org)

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

llvm-svn: 298718

7 years ago[PDB] Split item and type records when merging type streams
Reid Kleckner [Fri, 24 Mar 2017 17:26:38 +0000 (17:26 +0000)]
[PDB] Split item and type records when merging type streams

Summary: MSVC does this when producing a PDB.

Reviewers: ruiu

Subscribers: llvm-commits

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

llvm-svn: 298717

7 years ago[X86][SSE] Add ashr + mask test cases.
Simon Pilgrim [Fri, 24 Mar 2017 17:25:47 +0000 (17:25 +0000)]
[X86][SSE] Add ashr + mask test cases.

Test cases showing cases where we're missing an opportunity to lshr a value with an extended sign to avoid loading a mask

llvm-svn: 298716

7 years agoRevert "builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM...
Weiming Zhao [Fri, 24 Mar 2017 17:08:35 +0000 (17:08 +0000)]
Revert "builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA."

This reverts commit c3709191b6d36c4c936173f4a9a29a734b12cb15.
(commit by mistake)

llvm-svn: 298715

7 years ago[Compiler-rt][Builtins] Implement lit-test support (part 2 of 2)
Weiming Zhao [Fri, 24 Mar 2017 17:06:05 +0000 (17:06 +0000)]
[Compiler-rt][Builtins] Implement lit-test support (part 2 of 2)

Summary:
Original r297566 (https://reviews.llvm.org/D30802) is splitted into two parts.
This part adds CMakefile/lit.cfg support.

Reviewers: rengolin, compnerd, jroelofs, erik.pilkington

Subscribers: srhines, dberris, mgorny

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

llvm-svn: 298714

7 years agobuiltins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA.
Weiming Zhao [Fri, 24 Mar 2017 17:06:00 +0000 (17:06 +0000)]
builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA.

Summary:
Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.

Due to this:
 - use  __tbumb__ and __thumb2__ insteand of __ARM_ARCH_ISA_THUMB
 - use '.thumb' directive consistently  in all affected files
 - decorate all thumb functions using
   DEFINE_COMPILERRT_THUMB_FUNCTION()

---------
Note: This patch doesn't fix broken Thumb1 variant of __udivsi3 !

Reviewers: weimingz, rengolin, compnerd

Subscribers: aemerson, dim

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

llvm-svn: 298713

7 years agoFix MSVC 'not all control paths return a value' warning.
Simon Pilgrim [Fri, 24 Mar 2017 16:59:14 +0000 (16:59 +0000)]
Fix MSVC 'not all control paths return a value' warning.

llvm-svn: 298712

7 years ago[InstCombine] Provide a way to calculate KnownZero/One for Add/Sub in SimplifyDemande...
Craig Topper [Fri, 24 Mar 2017 16:56:51 +0000 (16:56 +0000)]
[InstCombine] Provide a way to calculate KnownZero/One for Add/Sub in SimplifyDemandedUseBits without recursing into ComputeKnownBits

SimplifyDemandedUseBits for Add/Sub already recursed down LHS and RHS for simplifying bits. If that didn't provide any simplifications we fall back to calling computeKnownBits which will recurse again. Instead just take the known bits for LHS and RHS we already have and call into a new function in ValueTracking that can calculate the known bits given the LHS/RHS bits.

llvm-svn: 298711

7 years ago[AMDGPU] Fix SGPR usage count in SI scheduler
Valery Pykhtin [Fri, 24 Mar 2017 16:45:50 +0000 (16:45 +0000)]
[AMDGPU] Fix SGPR usage count in SI scheduler

Patch by Axel Davy (axel.davy@normalesup.org)

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

llvm-svn: 298710

7 years ago[OpenCL][Bug 10573] Don't set CXXOperatorNames flag
Anastasia Stulova [Fri, 24 Mar 2017 16:43:51 +0000 (16:43 +0000)]
[OpenCL][Bug 10573] Don't set CXXOperatorNames flag

The flag CXXOperatorNames was overwritten unconditionally
after being set for OpenCL.

There seems to be no necessity to set it, so removing the line.

llvm-svn: 298709

7 years ago[AMDGPU] Add a new line after a debug message
Valery Pykhtin [Fri, 24 Mar 2017 16:37:48 +0000 (16:37 +0000)]
[AMDGPU] Add a new line after a debug message

Patch by Axel Davy (axel.davy@normalesup.org)

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

llvm-svn: 298708

7 years agoUpdate debug_external.cc testcase to use TSan-invisible barriers to reduce flakiness.
Kuba Mracek [Fri, 24 Mar 2017 16:37:02 +0000 (16:37 +0000)]
Update debug_external.cc testcase to use TSan-invisible barriers to reduce flakiness.

llvm-svn: 298707

7 years agoXFAIL the std::byte tests on a bunch of old clang versions, because they don't like...
Marshall Clow [Fri, 24 Mar 2017 16:17:20 +0000 (16:17 +0000)]
XFAIL the std::byte tests on a bunch of old clang versions, because they don't like 'std::byte b1{1}'

llvm-svn: 298706

7 years agostable-merge-request.sh: Add a script for submitting merge requests via bugzilla
Tom Stellard [Fri, 24 Mar 2017 16:13:18 +0000 (16:13 +0000)]
stable-merge-request.sh: Add a script for submitting merge requests via bugzilla

Summary:
This script will automatically create a new stable merge request bug in
bugzilla for the given svn revision and release number.

Reviewers: hans

Subscribers: llvm-commits

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

llvm-svn: 298705

7 years ago[X86][SSE] Generalised lowerTruncate by PACKSS to work with any 'zero/all bits' resul...
Simon Pilgrim [Fri, 24 Mar 2017 16:12:31 +0000 (16:12 +0000)]
[X86][SSE] Generalised lowerTruncate by PACKSS to work with any 'zero/all bits' result, not just comparisons.

Added vector compare opcodes to X86TargetLowering::ComputeNumSignBitsForTargetNode

Covered by existing tests added for D22814.

llvm-svn: 298704

7 years agoAnother instance where GCC doesn't understand implicit construction of StringLiteral.
Benjamin Kramer [Fri, 24 Mar 2017 14:17:56 +0000 (14:17 +0000)]
Another instance where GCC doesn't understand implicit construction of StringLiteral.

llvm-svn: 298703

7 years agoMake GCC happy again.
Benjamin Kramer [Fri, 24 Mar 2017 14:15:35 +0000 (14:15 +0000)]
Make GCC happy again.

llvm-svn: 298702

7 years agoDon't build up std::vectors with constant sizes when an array suffices.
Benjamin Kramer [Fri, 24 Mar 2017 14:11:47 +0000 (14:11 +0000)]
Don't build up std::vectors with constant sizes when an array suffices.

NFC.

llvm-svn: 298701

7 years agoRemove stale and unused (MC)TargetOptions comparators.
Teresa Johnson [Fri, 24 Mar 2017 12:50:45 +0000 (12:50 +0000)]
Remove stale and unused (MC)TargetOptions comparators.

Summary:
I discovered accidentally that the operator== for TargetOptions
is stale - it is missing many fields that have been added over
the recent years. It isn't used, so remove it. Ditto for the
comparator in MCTargetOptions, which doesn't seem stale yet but is
unused.

Reviewers: echristo

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 298700

7 years ago[analyzer] MisusedMovedObject: Remove deprecated callback. NFC
Artem Dergachev [Fri, 24 Mar 2017 10:16:08 +0000 (10:16 +0000)]
[analyzer] MisusedMovedObject: Remove deprecated callback. NFC

wantsRegionChangeUpdate() checker callback is no longer used since recently.

Fixes a buildbot warning.

llvm-svn: 298699

7 years ago[analyzer] Add MisusedMovedObjectChecker for detecting use-after-move errors.
Artem Dergachev [Fri, 24 Mar 2017 09:52:30 +0000 (09:52 +0000)]
[analyzer] Add MisusedMovedObjectChecker for detecting use-after-move errors.

The checker currently warns on copying, moving, or calling methods on an object
that was recently std::move'd from. It understands a set of "state reset"
methods that bring a moved-from object back to a well-specified state.

Patch by Peter Szecsi!

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

llvm-svn: 298698

7 years ago[libclang] Bury dead TemporaryFiles
Krasimir Georgiev [Fri, 24 Mar 2017 09:49:54 +0000 (09:49 +0000)]
[libclang] Bury dead TemporaryFiles

Summary:
AllocatedCXCodeCompleteResults::TemporaryFiles have turned into zombies.
Seven years ago they used to do their job during [[ https://github.com/llvm-mirror/clang/commit/313e26c4e81f0e467490a530548450f4c824a6c4/tools/CIndex/CIndexCodeCompletion.cpp#diff-02d3e692ad507b10af9458b775c5750bL261 | file remapping]], but now they are created just to be torn down in the destructor.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 298697

7 years ago[clangd] Add support for vscode extension configuration
Krasimir Georgiev [Fri, 24 Mar 2017 09:29:00 +0000 (09:29 +0000)]
[clangd] Add support for vscode extension configuration

Summary: Adds vscode workspace level configuration options for path to clangd binary and its arguments.
Contributed by stanionascu!

Reviewers: cfe-commits, bkramer, krasimir

Reviewed By: krasimir

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

llvm-svn: 298696

7 years agoRevert r298491 and r298494 which changed Clang's handling of 'nonnull'
Chandler Carruth [Fri, 24 Mar 2017 09:11:57 +0000 (09:11 +0000)]
Revert r298491 and r298494 which changed Clang's handling of 'nonnull'
attributes.

These patches don't work because we can't currently access the parameter
information in a reliable way when building attributes. I thought this
would be relatively straightforward to fix, but it seems not to be the
case. Fixing this will requrie a substantial re-plumbing of machinery to
allow attributes to be handled in this location, and several other fixes
to the attribute machinery should probably be made at the same time. All
of this will make the patch .... substantially more complicated.

Reverting for now as there are active miscompiles caused by the current
version.

llvm-svn: 298695

7 years agoThe expression text in AppleObjCRuntimeV1::CreateObjectChecker
Jason Molenda [Fri, 24 Mar 2017 08:01:16 +0000 (08:01 +0000)]
The expression text in AppleObjCRuntimeV1::CreateObjectChecker
was formatted into a string inside an assert() expression.
Which is elided when lldb is built with asserts disabled;
the result is that all expressions will fail when debugging
programs using the objective-c v1 runtime.

<rdar://problem/30353271>

llvm-svn: 298694

7 years agoRevert "[ScalarEvolution] Re-enable Predicate implication from operations"
Max Kazantsev [Fri, 24 Mar 2017 07:04:31 +0000 (07:04 +0000)]
Revert "[ScalarEvolution] Re-enable Predicate implication from operations"

This reverts commit rL298690

Causes failures on clang.

llvm-svn: 298693

7 years agoNewGVN: Small cleanup of two dominance related functions to make
Daniel Berlin [Fri, 24 Mar 2017 06:33:51 +0000 (06:33 +0000)]
NewGVN: Small cleanup of two dominance related functions to make
them easier to understand.

llvm-svn: 298692

7 years agoNewGVN: Small cleanup of useless expression deletion, and don't uselessly create...
Daniel Berlin [Fri, 24 Mar 2017 06:33:48 +0000 (06:33 +0000)]
NewGVN: Small cleanup of useless expression deletion, and don't uselessly create two expressions in symbolic store evaluation.

llvm-svn: 298691

7 years ago[ScalarEvolution] Re-enable Predicate implication from operations
Max Kazantsev [Fri, 24 Mar 2017 06:19:00 +0000 (06:19 +0000)]
[ScalarEvolution] Re-enable Predicate implication from operations

The patch rL298481 was reverted due to crash on clang-with-lto-ubuntu build.
The reason of the crash was type mismatch between either a or b and RHS in the following situation:

  LHS = sext(a +nsw b) > RHS.

This is quite rare, but still possible situation. Normally we need to cast all {a, b, RHS} to their widest type.
But we try to avoid creation of new SCEV that are not constants to avoid initiating recursive analysis that
can take a lot of time and/or cache a bad value for iterations number. To deal with this, in this patch we
reject this case and will not try to analyze it if the type of sum doesn't match with the type of RHS. In this
situation we don't need to create any non-constant SCEVs.

This patch also adds an assertion to the method IsProvedViaContext so that we could fail on it and not
go further into range analysis etc (because in some situations these analyzes succeed even when the passed
arguments have wrong types, what should not normally happen).

The patch also contains a fix for a problem with too narrow scope of the analysis caused by wrong
usage of predicates in recursive invocations.

The regression test on the said failure: test/Analysis/ScalarEvolution/implied-via-addition.ll

llvm-svn: 298690

7 years agoImplement P0298R3: 'std::byte'. Reviewed as https://reviews.llvm.org/D31022
Marshall Clow [Fri, 24 Mar 2017 05:45:39 +0000 (05:45 +0000)]
Implement P0298R3: 'std::byte'. Reviewed as https://reviews.llvm.org/D31022

llvm-svn: 298689

7 years ago[ValueTracking] Use uint64_t for CarryIn in computeKnownBitsAddSub instead of a creat...
Craig Topper [Fri, 24 Mar 2017 05:38:09 +0000 (05:38 +0000)]
[ValueTracking] Use uint64_t for CarryIn in computeKnownBitsAddSub instead of a creating a temporary APInt. NFC

llvm-svn: 298688

7 years agoNewGVN: Fix PR32403 - Handling of undef in phis was not quite correct
Daniel Berlin [Fri, 24 Mar 2017 05:30:34 +0000 (05:30 +0000)]
NewGVN: Fix PR32403 - Handling of undef in phis was not quite correct
due to LLVM's view of phi nodes.  It would cause NewGVN not to fixpoint
in some interesting edge cases.

llvm-svn: 298687

7 years agoMove the scoped_lock inside the '#ifndef NO_THREADS' block to fix the no-threading...
Marshall Clow [Fri, 24 Mar 2017 05:19:15 +0000 (05:19 +0000)]
Move the scoped_lock inside the '#ifndef NO_THREADS' block to fix the no-threading build

llvm-svn: 298686

7 years ago[XRay] [compiler-rt] Plug a file descriptor leak in a failure case.
Martin Pelikan [Fri, 24 Mar 2017 05:02:51 +0000 (05:02 +0000)]
[XRay] [compiler-rt] Plug a file descriptor leak in a failure case.

Summary: Fd needs to be closed before the number gets out of scope.

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 298685

7 years agoFix a warning when running the GotsanRuntimeCheck test on Darwin.
Kuba Mracek [Fri, 24 Mar 2017 03:57:27 +0000 (03:57 +0000)]
Fix a warning when running the GotsanRuntimeCheck test on Darwin.

llvm-svn: 298684

7 years ago[ValueTracking] Convert more places to use setHighBits/setLowBits/setSignBit. NFCI
Craig Topper [Fri, 24 Mar 2017 03:57:24 +0000 (03:57 +0000)]
[ValueTracking] Convert more places to use setHighBits/setLowBits/setSignBit. NFCI

llvm-svn: 298683

7 years agoUpdate the Darwin/external.cc testcase to use rpath. This means we can move the test...
Kuba Mracek [Fri, 24 Mar 2017 03:53:44 +0000 (03:53 +0000)]
Update the Darwin/external.cc testcase to use rpath. This means we can move the test output executables and still be able to run them.

llvm-svn: 298682

7 years agoImplement Pp0156r2: 'Variadic Lock Guard, version 5' Reviewed as https://reviews...
Marshall Clow [Fri, 24 Mar 2017 03:40:36 +0000 (03:40 +0000)]
Implement Pp0156r2: 'Variadic Lock Guard, version 5'  Reviewed as https://reviews.llvm.org/D31163.

llvm-svn: 298681

7 years ago[InstCombine] Use range-based for loop. NFC
Craig Topper [Fri, 24 Mar 2017 02:58:02 +0000 (02:58 +0000)]
[InstCombine] Use range-based for loop. NFC

llvm-svn: 298680

7 years ago[InstCombine] Fix 80 column violation I accidentally introduced. NFC
Craig Topper [Fri, 24 Mar 2017 02:57:59 +0000 (02:57 +0000)]
[InstCombine] Fix 80 column violation I accidentally introduced. NFC

llvm-svn: 298679

7 years ago[CMake] Support single target builtins build on Darwin
Petr Hosek [Fri, 24 Mar 2017 02:21:11 +0000 (02:21 +0000)]
[CMake] Support single target builtins build on Darwin

This change allows cross-compiling compiler-rt builtins for
multiple targets as part of runtimes on Darwin. This functionality
is already supported on other platforms.

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

llvm-svn: 298678

7 years ago[AVR] Fix build after r298178
Meador Inge [Fri, 24 Mar 2017 01:57:29 +0000 (01:57 +0000)]
[AVR] Fix build after r298178

r298178 capitalized the fields in `ArgListEntry`.  All the official
targets were updated accordingly, but as an experimental target AVR
was missed.

llvm-svn: 298677

7 years agoFix handling of initialization from parenthesized initializer list.
Richard Smith [Fri, 24 Mar 2017 01:14:25 +0000 (01:14 +0000)]
Fix handling of initialization from parenthesized initializer list.

This change fixes a crash on initialization of a reference from ({}) during
template instantiation and incidentally improves diagnostics.

This reverts a prior attempt to handle this in r286721. Instead, we teach the
initialization code that initialization cannot be performed if a source type
is required and the initializer is an initializer list (which is not an
expression and does not have a type), and likewise for function-style cast
expressions.

llvm-svn: 298676

7 years agoReturn early.
Rui Ueyama [Fri, 24 Mar 2017 01:13:30 +0000 (01:13 +0000)]
Return early.

llvm-svn: 298675

7 years ago[libFuzzer] split two tests to get more parallelism in test runs
Kostya Serebryany [Fri, 24 Mar 2017 00:51:18 +0000 (00:51 +0000)]
[libFuzzer] split two tests to get more parallelism in test runs

llvm-svn: 298673

7 years agoEarly continue. NFC.
Rui Ueyama [Fri, 24 Mar 2017 00:50:37 +0000 (00:50 +0000)]
Early continue. NFC.

The original code is a big `if` and `else` which ends with `continue`
like this:

  if (cond) {
    ...
    // fall through
  } else {
    ...
    continue;
  }

This patch rewrites it with the following.

  if (!cond) {
    ...
    continue;
  }
  ...

llvm-svn: 298672

7 years ago[libFuzzer] increase kFeatureSetSize to 2^21 and make InputCorpus scale to that size...
Kostya Serebryany [Fri, 24 Mar 2017 00:45:15 +0000 (00:45 +0000)]
[libFuzzer] increase kFeatureSetSize to 2^21 and make InputCorpus scale to that size. This will potentially make libFuzzer more sensitive on targets with lots of signals

llvm-svn: 298671

7 years ago[XRay] Do not depend on C++ stdlib for XRay builds
Dean Michael Berris [Fri, 24 Mar 2017 00:20:05 +0000 (00:20 +0000)]
[XRay] Do not depend on C++ stdlib for XRay builds

Summary:
Now that XRay doesn't require a runtime dependency on a C++ standard
library, we remove that dependency from the clang linker flags.

Reviewers: saugustine, pelikan

Subscribers: cfe-commits

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

llvm-svn: 298670

7 years agoUpdate comments.
Rui Ueyama [Fri, 24 Mar 2017 00:15:57 +0000 (00:15 +0000)]
Update comments.

llvm-svn: 298669

7 years agoUse `using namespace lld` for consistency with other files.
Rui Ueyama [Fri, 24 Mar 2017 00:15:37 +0000 (00:15 +0000)]
Use `using namespace lld` for consistency with other files.

llvm-svn: 298668

7 years agoMove a few functions to a new file Filesystem.{cpp,h}.
Rui Ueyama [Fri, 24 Mar 2017 00:15:16 +0000 (00:15 +0000)]
Move a few functions to a new file Filesystem.{cpp,h}.

llvm-svn: 298667

7 years ago[libFuzzer] fix non-linux build
Kostya Serebryany [Thu, 23 Mar 2017 23:48:47 +0000 (23:48 +0000)]
[libFuzzer] fix non-linux build

llvm-svn: 298666

7 years agoRefactor code to reduce indentation and improve readability. (NFC)
Adrian Prantl [Thu, 23 Mar 2017 23:35:09 +0000 (23:35 +0000)]
Refactor code to reduce indentation and improve readability. (NFC)

llvm-svn: 298665

7 years agoFix a bug when emitting debug info for partially constant global variables.
Adrian Prantl [Thu, 23 Mar 2017 23:35:00 +0000 (23:35 +0000)]
Fix a bug when emitting debug info for partially constant global variables.

While fixing a malformed testcase, I discovered that the code
exercised by it was wrong, too.

llvm-svn: 298664

7 years agoRemove uses of std::binary_function, removed in C++17.
Richard Smith [Thu, 23 Mar 2017 23:32:03 +0000 (23:32 +0000)]
Remove uses of std::binary_function, removed in C++17.

llvm-svn: 298663

7 years ago[sancov] Don't instrument blocks with no insertion point
Reid Kleckner [Thu, 23 Mar 2017 23:30:41 +0000 (23:30 +0000)]
[sancov] Don't instrument blocks with no insertion point

This prevents crashes when attempting to instrument functions containing
C++ try.

Sanitizer coverage will still fail at runtime when an exception is
thrown through a sancov instrumented function, but that seems marginally
better than what we have now. The full solution is to color the blocks
in LLVM IR and only instrument blocks that have an unambiguous color,
using the appropriate token.

llvm-svn: 298662

7 years agoFix trellis layout to avoid mis-identify triangle.
Dehao Chen [Thu, 23 Mar 2017 23:28:09 +0000 (23:28 +0000)]
Fix trellis layout to avoid mis-identify triangle.

Summary:
For the following CFG:

A->B
B->C
A->C

If there is another edge B->D, then ABC should not be considered as triangle.

Reviewers: davidxl, iteratee

Reviewed By: iteratee

Subscribers: nemanjai, llvm-commits

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

llvm-svn: 298661

7 years agoSet the prof weight correctly for call instructions in DeadArgumentElimination.
Dehao Chen [Thu, 23 Mar 2017 23:26:00 +0000 (23:26 +0000)]
Set the prof weight correctly for call instructions in DeadArgumentElimination.

Summary: In DeadArgumentElimination, the call instructions will be replaced. We also need to set the prof weights so that function inlining can find the correct profile.

Reviewers: eraman

Reviewed By: eraman

Subscribers: llvm-commits

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

llvm-svn: 298660

7 years ago[MetaRenamer] Don't rename library functions.
Bryant Wong [Thu, 23 Mar 2017 23:21:07 +0000 (23:21 +0000)]
[MetaRenamer] Don't rename library functions.

Library functions can have specific semantics that affect the behavior of
certain passes. DSE, for instance, gives special treatment to malloc-ed pointers
but not to pointers returned from an equivalently typed (but differently named)
function.

MetaRenamer ought not to alter program semantics, so library functions must
remain untouched.

Reviewers: mehdi_amini, majnemer, chandlerc, davide

Reviewed By: davide

Subscribers: davide, llvm-commits

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

llvm-svn: 298659

7 years agoAdd strtok interceptor for ASAN for Windows.
Alex Shlyapnikov [Thu, 23 Mar 2017 23:20:47 +0000 (23:20 +0000)]
Add strtok interceptor for ASAN for Windows.

Summary: Fixes test broken by D30384

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 298658

7 years agoRemove all uses of std::mem_fun and std::bind1st removed in C++17.
Richard Smith [Thu, 23 Mar 2017 23:17:58 +0000 (23:17 +0000)]
Remove all uses of std::mem_fun and std::bind1st removed in C++17.

llvm-svn: 298657

7 years agoUse isFunctionHotInCallGraph to set the function section prefix.
Dehao Chen [Thu, 23 Mar 2017 23:14:11 +0000 (23:14 +0000)]
Use isFunctionHotInCallGraph to set the function section prefix.

Summary: The current prefix based function layout algorithm only looks at function's entry count, which is not sufficient. A function should be grouped together if its entry count or any call edge count is hot.

Reviewers: davidxl, eraman

Reviewed By: eraman

Subscribers: llvm-commits

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

llvm-svn: 298656

7 years ago[Hexagon] Avoid infinite loops in HexagonLoopIdiomRecognition
Krzysztof Parzyszek [Thu, 23 Mar 2017 23:01:22 +0000 (23:01 +0000)]
[Hexagon] Avoid infinite loops in HexagonLoopIdiomRecognition

- Avoid explosive growth of the simplification queue by not queuing
  expressions that are alredy in it.
- Add an iteration counter and abort after a sufficiently large number
  of iterations (assuming that it's a symptom of an infinite loop).

llvm-svn: 298655

7 years ago[libFuzzer] create experimental support for user-provided coverage signal
Kostya Serebryany [Thu, 23 Mar 2017 22:43:12 +0000 (22:43 +0000)]
[libFuzzer] create experimental support for user-provided coverage signal

llvm-svn: 298654

7 years ago[CMake] Provide an option to disable runtimes build
Petr Hosek [Thu, 23 Mar 2017 22:40:10 +0000 (22:40 +0000)]
[CMake] Provide an option to disable runtimes build

This could be used to either disable the runtimes build altogether
or avoid building them but still generate the build targets.

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

llvm-svn: 298653

7 years agoMove spill size and alignment info from MC to TargetRegisterInfo
Krzysztof Parzyszek [Thu, 23 Mar 2017 22:32:22 +0000 (22:32 +0000)]
Move spill size and alignment info from MC to TargetRegisterInfo

This is another step towards implementing register classes with
parametrized register/spill sizes.

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

llvm-svn: 298652

7 years ago[Outliner] Remove unused lambda capture.
Jessica Paquette [Thu, 23 Mar 2017 22:17:20 +0000 (22:17 +0000)]
[Outliner] Remove unused lambda capture.

Remove an unused lambda capture that made some bots unhappy.

llvm-svn: 298651

7 years ago[asan] Add an interceptor for strtok
Alex Shlyapnikov [Thu, 23 Mar 2017 21:39:52 +0000 (21:39 +0000)]
[asan] Add an interceptor for strtok

Summary:
This change addresses https://github.com/google/sanitizers/issues/766. I
tested the change with make check-asan and the newly added test case.

Reviewers: ygribov, kcc, alekseyshl

Subscribers: kubamracek, llvm-commits

Patch by mrigger

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

llvm-svn: 298650

7 years ago[PDB] Use two DBs when dumping the IPI stream
Reid Kleckner [Thu, 23 Mar 2017 21:36:25 +0000 (21:36 +0000)]
[PDB] Use two DBs when dumping the IPI stream

Summary:
When dumping these records from an object file section, we should use
only one type database. However, when dumping from a PDB, we should use
two: one for the type stream and one for the IPI stream.

Certain type records that normally live in the .debug$T object file
section get moved over to the IPI stream of the PDB file and they get
new indices.

So far, I've noticed that the MSVC linker always moves these records
into IPI:
- LF_FUNC_ID
- LF_MFUNC_ID
- LF_STRING_ID
- LF_SUBSTR_LIST
- LF_BUILDINFO
- LF_UDT_MOD_SRC_LINE

These records have index fields that can point into TPI or IPI. In
particular, LF_SUBSTR_LIST and LF_BUILDINFO point to LF_STRING_ID
records to describe compilation command lines.

I've modified the dumper to have an optional pointer to the item DB, and
to do type name lookup of these fields in that DB. See printItemIndex.
The result is that our pdbdump-headers.test is more faithful to the PDB
contents and the output is less confusing.

Reviewers: ruiu

Subscribers: amccarth, zturner, llvm-commits

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

llvm-svn: 298649

7 years ago[Outliner] Fix compile-time overhead for candidate choice
Jessica Paquette [Thu, 23 Mar 2017 21:27:38 +0000 (21:27 +0000)]
[Outliner] Fix compile-time overhead for candidate choice

The old candidate collection method in the outliner caused some very large
regressions in compile time on large tests. For MultiSource/Benchmarks/7zip it
caused a 284.07 s or 1156% increase in compile time. On average, using the
SingleSource/MultiSource tests, it caused an average increase of 8 seconds in
compile time (something like 1000%).

This commit replaces that candidate collection method with a new one which
only visits each node in the tree once. This reduces the worst compile time
increase (still 7zip) to a 0.542 s overhead (22%) and the average compile time
increase on SingleSource and MultiSource to 0.018 s (4%).

llvm-svn: 298648

7 years agoUpdate the SamplePGO test to verify that unroll/icp is not invoked in thinlto compile...
Dehao Chen [Thu, 23 Mar 2017 21:20:17 +0000 (21:20 +0000)]
Update the SamplePGO test to verify that unroll/icp is not invoked in thinlto compile phase.

Summary: This is the test added for https://reviews.llvm.org/D31217

Reviewers: tejohnson, mehdi_amini

Reviewed By: tejohnson

Subscribers: cfe-commits, Prazek

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

llvm-svn: 298647

7 years agoDisable loop unrolling and icp in SamplePGO ThinLTO compile phase
Dehao Chen [Thu, 23 Mar 2017 21:20:05 +0000 (21:20 +0000)]
Disable loop unrolling and icp in SamplePGO ThinLTO compile phase

Summary:
loop unrolling and icp will make the sample profile annotation much harder in the backend. So disable these 2 optimization in the ThinLTO compile phase.
Will add a test in cfe in a separate patch.

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: mehdi_amini, llvm-commits, Prazek

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

llvm-svn: 298646

7 years agoRemove unnecessary use of std::result_of, which is deprecated in C++17.
Richard Smith [Thu, 23 Mar 2017 21:02:31 +0000 (21:02 +0000)]
Remove unnecessary use of std::result_of, which is deprecated in C++17.

llvm-svn: 298645

7 years ago[InstCombine] Remove some code from visitAnd that dealt with trying to reduce the...
Craig Topper [Thu, 23 Mar 2017 21:00:13 +0000 (21:00 +0000)]
[InstCombine] Remove some code from visitAnd that dealt with trying to reduce the LHS of a sub to 0. This should now be fully handled by SimplifyDemandedInstructionBits now.

Now that we call ShrinkDemandedConstant on the RHS of sub this should be taken care of. This code doesn't trigger on any in tree regressions, but did before ShrinkDemandedConstant was added to the RHS.

llvm-svn: 298644

7 years agoLLVM Changes for alloc_align
Erich Keane [Thu, 23 Mar 2017 20:38:34 +0000 (20:38 +0000)]
LLVM Changes for alloc_align

GCC has the alloc_align attribute, which is similar to assume_aligned, except the attribute's parameter is the index of the integer parameter that needs aligning to.

This is the required LLVM changes to make this happen.

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

llvm-svn: 298643

7 years agoZero-Initialize PrevInstBB when entering a new MachineFunction.
Adrian Prantl [Thu, 23 Mar 2017 20:23:42 +0000 (20:23 +0000)]
Zero-Initialize PrevInstBB when entering a new MachineFunction.

It is not guaranteed that the memory used for MachineBasicBlocks in
the previous MachineFunction hasn't been freed, so holding on to a
pointer to the last function's isn't correct. Particularly I have
observed the sret.ll testcase failing because the first BasicBlock in
the new function happened to be allocated to the exact same memory as
the previously saved and (deleted) PrevInstBB.

llvm-svn: 298642

7 years ago[LV] Add regression test for r297610
Gil Rapaport [Thu, 23 Mar 2017 20:02:23 +0000 (20:02 +0000)]
[LV] Add regression test for r297610

The new test asserts that scalarized memory operations get memcheck metadata
added even if the loop is only unrolled.

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

llvm-svn: 298641

7 years ago[LVIPrinterPass] Print LVI info for function arguments
Anna Thomas [Thu, 23 Mar 2017 20:00:54 +0000 (20:00 +0000)]
[LVIPrinterPass] Print LVI info for function arguments

Using AssemblyAnnotationWriter for LVI printer prints
for instructions and basic blocks.
So, we explicitly need to print LVI info for the arguments of the function (these
are values and not instructions).

llvm-svn: 298640