platform/upstream/llvm.git
6 years ago[CodeGen] Only print successors when the list is not empty
Francis Visoiu Mistrih [Fri, 9 Feb 2018 00:12:53 +0000 (00:12 +0000)]
[CodeGen] Only print successors when the list is not empty

Follow-up of r324685.

llvm-svn: 324686

6 years ago[CodeGen] Unify the syntax of MBB successors in MIR and -debug output
Francis Visoiu Mistrih [Fri, 9 Feb 2018 00:10:31 +0000 (00:10 +0000)]
[CodeGen] Unify the syntax of MBB successors in MIR and -debug output

Instead of:

Successors according to CFG: %bb.6(0x12492492 / 0x80000000 = 14.29%)

print:

successors: %bb.6(0x12492492); %bb.6(14.29%)
llvm-svn: 324685

6 years agoRemove Config->Verbose because we have errorHandler().Verbose.
Rui Ueyama [Thu, 8 Feb 2018 23:52:09 +0000 (23:52 +0000)]
Remove Config->Verbose because we have errorHandler().Verbose.

llvm-svn: 324684

6 years agoFix --print-icf-sections output.
Rui Ueyama [Thu, 8 Feb 2018 23:51:58 +0000 (23:51 +0000)]
Fix --print-icf-sections output.

Previously, multiple chunks of --print-icf-sections messages were interleaved
and didn't make sense. This is because forEachClass is multi-threaded.

llvm-svn: 324683

6 years agoAdd size to constexpr Arrays
Erich Keane [Thu, 8 Feb 2018 23:49:40 +0000 (23:49 +0000)]
Add size to constexpr Arrays

What seems to be a bug in older versions of MSVC, constexpr
member arrays with a redefinition (to force emission) require
their initial definition to have the size between the brackets.

llvm-svn: 324682

6 years ago[CodeGen] Move printing '\n' from MachineInstr::print to MachineBasicBlock::print
Francis Visoiu Mistrih [Thu, 8 Feb 2018 23:42:27 +0000 (23:42 +0000)]
[CodeGen] Move printing '\n' from MachineInstr::print to MachineBasicBlock::print

MBB.print wasn't printing it, but the MIRPrinter is printing it. The
goal is to unify that as much as possible.

llvm-svn: 324681

6 years ago[analyzer] MallocChecker: Fix one more bug category.
Artem Dergachev [Thu, 8 Feb 2018 23:28:29 +0000 (23:28 +0000)]
[analyzer] MallocChecker: Fix one more bug category.

Even though most of the inconsistencies in MallocChecker's bug categories were
fixed in r302016, one more was introduced in r301913 which was later missed.

Patch by Henry Wong!

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

llvm-svn: 324680

6 years ago[Lanai] Code model dictates section selection.
Jacques Pienaar [Thu, 8 Feb 2018 23:25:05 +0000 (23:25 +0000)]
[Lanai] Code model dictates section selection.

Always use the small section when the small code model is specified.

llvm-svn: 324679

6 years ago[x86] consolidate and add tests for undef binop folds; NFC
Sanjay Patel [Thu, 8 Feb 2018 23:21:44 +0000 (23:21 +0000)]
[x86] consolidate and add tests for undef binop folds; NFC

As was already shown in the div/rem tests and noted in PR36305,
the behavior is inconsistent, but it's not limited to div/rem only.

llvm-svn: 324678

6 years agoUse a stable topological sort in DwarfCompileUnit::createScopeChildrenDIE()
Adrian Prantl [Thu, 8 Feb 2018 23:21:15 +0000 (23:21 +0000)]
Use a stable topological sort in DwarfCompileUnit::createScopeChildrenDIE()

This addresses review feedback for D42940. The topological sort is
slightly more expensive but it can now also detect cycles in the
dependencies and actually works correctly.

rdar://problem/37217988

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

llvm-svn: 324677

6 years agoAdd Rest of Targets Support to ValidCPUList (enabling march notes)
Erich Keane [Thu, 8 Feb 2018 23:16:55 +0000 (23:16 +0000)]
Add Rest of Targets Support to ValidCPUList (enabling march notes)

A followup to: https://reviews.llvm.org/D42978

Most of the rest of the Targets were pretty rote, so this
patch knocks them all out at once.

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

llvm-svn: 324676

6 years agoAdd NVPTX Support to ValidCPUList (enabling march notes)
Erich Keane [Thu, 8 Feb 2018 23:16:00 +0000 (23:16 +0000)]
Add NVPTX Support to ValidCPUList (enabling march notes)

A followup to: https://reviews.llvm.org/D42978
This patch adds NVPTX support for
enabling the march notes.

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

llvm-svn: 324675

6 years agoAdd X86 Support to ValidCPUList (enabling march notes)
Erich Keane [Thu, 8 Feb 2018 23:15:02 +0000 (23:15 +0000)]
Add X86 Support to ValidCPUList (enabling march notes)

A followup to: https://reviews.llvm.org/D42978
This patch adds X86 and X86_64 support for
enabling the march notes.

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

llvm-svn: 324674

6 years agoMake march/target-cpu print a note with the list of valid values for ARM
Erich Keane [Thu, 8 Feb 2018 23:14:15 +0000 (23:14 +0000)]
Make march/target-cpu print a note with the list of valid values for ARM

When rejecting a march= or target-cpu command line parameter,
the message is quite lacking. This patch adds a note that prints
all possible values for the current target, if the target supports it.

This adds support for the ARM/AArch64 targets (more to come!).

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

llvm-svn: 324673

6 years agoRecognize MSVC style mangling in CPlusPlusLanguage::IsCPPMangledName
Aaron Smith [Thu, 8 Feb 2018 23:11:56 +0000 (23:11 +0000)]
Recognize MSVC style mangling in CPlusPlusLanguage::IsCPPMangledName

Reviewers: zturner, lldb-commits, labath

Reviewed By: zturner

Subscribers: jingham, labath, davide, llvm-commits

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

llvm-svn: 324672

6 years agoOnly throw -fPIC when building a shared library
Aaron Smith [Thu, 8 Feb 2018 23:10:29 +0000 (23:10 +0000)]
Only throw -fPIC when building a shared library

Summary:
Update makefiles to specify -fPIC in Makefile.rules and only throw -fPIC when building a shared library. This change is necessary to allow building the lldb tests on Windows where -fPIC is not a valid option.

Update a few places to Python 3.x syntax

Reviewers: zturner, lldb-commits

Reviewed By: zturner

Subscribers: stella.stamenova, labath, llvm-commits

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

llvm-svn: 324671

6 years agoMinor tweak to test case.
Dmitry Mikulin [Thu, 8 Feb 2018 23:10:07 +0000 (23:10 +0000)]
Minor tweak to test case.

llvm-svn: 324670

6 years ago[DWARFv5] Fix dumper to show the file table starts at index 0.
Paul Robinson [Thu, 8 Feb 2018 23:08:02 +0000 (23:08 +0000)]
[DWARFv5] Fix dumper to show the file table starts at index 0.

Emitting the correct (root of compilation) file at index 0 will be
posted for review later; I wanted to get this minor change out of the
way first.

llvm-svn: 324669

6 years ago[CFG] Add extra context to C++ constructor statement elements.
Artem Dergachev [Thu, 8 Feb 2018 22:58:15 +0000 (22:58 +0000)]
[CFG] Add extra context to C++ constructor statement elements.

This patch adds a new CFGStmt sub-class, CFGConstructor, which replaces
the regular CFGStmt with CXXConstructExpr in it whenever the CFG has additional
information to provide regarding what sort of object is being constructed.

It is useful for figuring out what memory is initialized in client of the
CFG such as the Static Analyzer, which do not operate by recursive AST
traversal, but instead rely on the CFG to provide all the information when they
need it. Otherwise, the statement that triggers the construction and defines
what memory is being initialized would normally occur after the
construct-expression, and the client would need to peek to the next CFG element
or use statement parent map to understand the necessary facts about
the construct-expression.

As a proof of concept, CFGConstructors are added for new-expressions
and the respective test cases are provided to demonstrate how it works.

For now, the only additional data contained in the CFGConstructor element is
the "trigger statement", such as new-expression, which is the parent of the
constructor. It will be significantly expanded in later commits. The additional
data is organized as an auxiliary structure - the "construction context",
which is allocated separately from the CFGElement.

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

llvm-svn: 324668

6 years agoAMDGPU: Process SDWA block at a time
Matt Arsenault [Thu, 8 Feb 2018 22:46:41 +0000 (22:46 +0000)]
AMDGPU: Process SDWA block at a time

Right now this loops over the entire function every time there
is a change, which is not very efficient. There's no practical
reason to track this so globally, since the code motion optimization
passes should be sinking instructions with single uses and
the pass currently will not fold with multiple uses.

llvm-svn: 324667

6 years agoAMDGPU: Minor cleanups
Matt Arsenault [Thu, 8 Feb 2018 22:46:38 +0000 (22:46 +0000)]
AMDGPU: Minor cleanups

Column limit, typo, unnecessary reference

llvm-svn: 324666

6 years ago[GlobalISel][X86] Fixing failures after https://reviews.llvm.org/D37775
Alexander Ivchenko [Thu, 8 Feb 2018 22:41:47 +0000 (22:41 +0000)]
[GlobalISel][X86] Fixing failures after https://reviews.llvm.org/D37775

The patch essentially makes sure that X86CallLowering adds proper
G_COPY/G_TRUNC and G_ANYEXT/G_COPY when we are doing lowering of
arguments/returns for floating point values passed on registers.

Tests are updated accordingly

Reviewed By: qcolombet

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

llvm-svn: 324665

6 years ago[GlobalIsel][X86] Making {G_IMPLICIT_DEF, s128} legal
Alexander Ivchenko [Thu, 8 Feb 2018 22:40:31 +0000 (22:40 +0000)]
[GlobalIsel][X86] Making {G_IMPLICIT_DEF, s128} legal

The patch is a split from D42287 and is related to
fixing failures after https://reviews.llvm.org/D37775

Reviewed By: qcolombet

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

llvm-svn: 324664

6 years ago[analyzer] Self-debug: Dump the core's internal state traits to the egraph.
Artem Dergachev [Thu, 8 Feb 2018 22:32:38 +0000 (22:32 +0000)]
[analyzer] Self-debug: Dump the core's internal state traits to the egraph.

It is useful for debugging problems with C++ operator new() or temporaries.

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

llvm-svn: 324663

6 years ago[X86] Improve combineCastedMaskArithmetic to fold (bitcast (vXi1 (and/or/xor X, C...
Craig Topper [Thu, 8 Feb 2018 22:26:39 +0000 (22:26 +0000)]
[X86] Improve combineCastedMaskArithmetic to fold (bitcast (vXi1 (and/or/xor X, C)))->(vXi1 (and/or/xor (bitcast X), (bitcast C)) where C is a constant build_vector.

Most vxi1 constant build vectors have to be implemented in the scalar domain anyway so we'll probably end up with a cast there later. But by then its too late to do the combine to get rid of it.

llvm-svn: 324662

6 years ago[X86] Add DAG combine to constant fold a bitcast of a vXi1 constant build_vector...
Craig Topper [Thu, 8 Feb 2018 22:26:36 +0000 (22:26 +0000)]
[X86] Add DAG combine to constant fold a bitcast of a vXi1 constant build_vector into a scalar integer.

llvm-svn: 324661

6 years ago[analyzer] Self-debug: Dump environment frame-by-frame.
Artem Dergachev [Thu, 8 Feb 2018 22:24:38 +0000 (22:24 +0000)]
[analyzer] Self-debug: Dump environment frame-by-frame.

It makes it easier to discriminate between values of similar expressions
in different stack frames.

It also makes the separate backtrace section in ExplodedGraph dumps redundant.

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

llvm-svn: 324660

6 years agoCMake: Explicitly #undef LLVM_REVISION rather than using a blank file
Justin Bogner [Thu, 8 Feb 2018 22:19:00 +0000 (22:19 +0000)]
CMake: Explicitly #undef LLVM_REVISION rather than using a blank file

Including a blank file is confusing and makes it look like something
went wrong. Rather than requiring people know why this is blank, let's
just make it explicitly #undef the macro that it would define if it
weren't empty.

llvm-svn: 324659

6 years ago[ThinLTO] Skip BlockAddresses while replacing uses in function import.
Dmitry Mikulin [Thu, 8 Feb 2018 22:14:56 +0000 (22:14 +0000)]
[ThinLTO] Skip BlockAddresses while replacing uses in function import.

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

llvm-svn: 324658

6 years agoParameterize a test.
Paul Robinson [Thu, 8 Feb 2018 22:09:17 +0000 (22:09 +0000)]
Parameterize a test.

llvm-svn: 324657

6 years ago[ELF] Don't sort non reorderable sections with --symbol-ordering-file
Michael J. Spencer [Thu, 8 Feb 2018 22:03:23 +0000 (22:03 +0000)]
[ELF] Don't sort non reorderable sections with --symbol-ordering-file

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

llvm-svn: 324656

6 years agoRewrite testcase to not depend on Foundation implementation details.
Adrian Prantl [Thu, 8 Feb 2018 21:52:28 +0000 (21:52 +0000)]
Rewrite testcase to not depend on Foundation implementation details.

TODO: Add a separate testcase testing *only* Foundation implementation details!

<rdar://problem/37252738>

llvm-svn: 324655

6 years ago[DSan] Update uses of memory intrinsic get/setAlignment to new API (NFC)
Daniel Neilson [Thu, 8 Feb 2018 21:28:26 +0000 (21:28 +0000)]
[DSan] Update uses of memory intrinsic get/setAlignment to new API (NFC)

Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
DataFlowSanitizer pass to cease using the old get/setAlignment() API of MemoryIntrinsic
in favour of getting source & dest specific alignments through the new API.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, rL324148, rL324273, rL324278,
rL324384, rL324395, rL324402, rL324626, rL324642, rL324653 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

llvm-svn: 324654

6 years ago[ASan] Update uses of IRBuilder::CreateMemCpy to new API (NFC)
Daniel Neilson [Thu, 8 Feb 2018 21:26:12 +0000 (21:26 +0000)]
[ASan] Update uses of IRBuilder::CreateMemCpy to new API (NFC)

Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
AddressSanitizer pass to cease using The old IRBuilder CreateMemCpy single-alignment API
in favour of the new API that allows setting source and destination alignments independently.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, rL324148, rL324273, rL324278,
rL324384, rL324395, rL324402, rL324626, rL324642 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

llvm-svn: 324653

6 years ago[analyzer] [tests] Test different projects concurrently
George Karpenkov [Thu, 8 Feb 2018 21:22:42 +0000 (21:22 +0000)]
[analyzer] [tests] Test different projects concurrently

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

llvm-svn: 324652

6 years agoPR36307: Consume the #pragma options align annotation token after
Alex Lorenz [Thu, 8 Feb 2018 21:20:43 +0000 (21:20 +0000)]
PR36307: Consume the #pragma options align annotation token after
semantic analysis to prevent incorrect -Wpragma-pack warning for an included
file

rdar://37354951

llvm-svn: 324651

6 years agoRevert "WIP: [DAGCombiner] Assert that debug info is preserved"
Vedant Kumar [Thu, 8 Feb 2018 20:27:35 +0000 (20:27 +0000)]
Revert "WIP: [DAGCombiner] Assert that debug info is preserved"

This reverts commit r324648. It was committed accidentally.

llvm-svn: 324650

6 years ago[bugpoint] Simplify the global initializer reducer, NFC
Vedant Kumar [Thu, 8 Feb 2018 20:27:09 +0000 (20:27 +0000)]
[bugpoint] Simplify the global initializer reducer, NFC

Fix the comments, use early exits, use unique_ptr, and use ranged for
loops.

This is in preparation for a global *variable* reducer, which, with any
luck will help us clean up test cases.

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

llvm-svn: 324649

6 years agoWIP: [DAGCombiner] Assert that debug info is preserved
Vedant Kumar [Thu, 8 Feb 2018 20:27:09 +0000 (20:27 +0000)]
WIP: [DAGCombiner] Assert that debug info is preserved

llvm-svn: 324648

6 years ago[X86] Replace kortest intrinsics with native IR.
Craig Topper [Thu, 8 Feb 2018 20:16:17 +0000 (20:16 +0000)]
[X86] Replace kortest intrinsics with native IR.

llvm-svn: 324647

6 years ago[X86] Remove kortest intrinsics and replace with native IR.
Craig Topper [Thu, 8 Feb 2018 20:16:06 +0000 (20:16 +0000)]
[X86] Remove kortest intrinsics and replace with native IR.

llvm-svn: 324646

6 years ago[X86] Support 'V' register operand modifier
David Woodhouse [Thu, 8 Feb 2018 20:06:05 +0000 (20:06 +0000)]
[X86] Support 'V' register operand modifier

This allows the register name to be printed without the leading '%'.
This can be used for emitting calls to the retpoline thunks from inline
asm.

llvm-svn: 324645

6 years agoFix improper indentation issue in CodeGenModule [NFC]
Erich Keane [Thu, 8 Feb 2018 20:04:22 +0000 (20:04 +0000)]
Fix improper indentation issue in CodeGenModule [NFC]

llvm-svn: 324644

6 years agoFix missing field initializer warning in TableGen SubtargetEmitter
David Blaikie [Thu, 8 Feb 2018 19:57:05 +0000 (19:57 +0000)]
Fix missing field initializer warning in TableGen SubtargetEmitter

llvm-svn: 324643

6 years ago[MSan] Update uses of IRBuilder::CreateMemCpy to new API (NFC)
Daniel Neilson [Thu, 8 Feb 2018 19:46:12 +0000 (19:46 +0000)]
[MSan] Update uses of IRBuilder::CreateMemCpy to new API (NFC)

Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
MemorySanitizer pass to cease using the old IRBuilder CreateMemCpy single-alignment APIs
in favour of the new API that allows setting source and destination alignments independently.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, rL324148, rL324273, rL324278,
rL324384, rL324395, rL324402, rL324626 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

llvm-svn: 324642

6 years agoFix crash on array initializer with non-0 alloca addrspace
Matt Arsenault [Thu, 8 Feb 2018 19:37:09 +0000 (19:37 +0000)]
Fix crash on array initializer with non-0 alloca addrspace

llvm-svn: 324641

6 years agoThe apple versions of clang don't support deduction guides yet.
Marshall Clow [Thu, 8 Feb 2018 19:33:03 +0000 (19:33 +0000)]
The apple versions of clang don't support deduction guides yet.

llvm-svn: 324640

6 years agoRegenerate test
Simon Pilgrim [Thu, 8 Feb 2018 19:28:05 +0000 (19:28 +0000)]
Regenerate test

llvm-svn: 324639

6 years ago[X86] Add common CHECK prefix to shift combine tests
Simon Pilgrim [Thu, 8 Feb 2018 19:23:47 +0000 (19:23 +0000)]
[X86] Add common CHECK prefix to shift combine tests

llvm-svn: 324638

6 years ago[X86] Add shift undef, %X tests
Simon Pilgrim [Thu, 8 Feb 2018 19:20:34 +0000 (19:20 +0000)]
[X86] Add shift undef, %X tests

llvm-svn: 324637

6 years ago[InstCombine] visitSRem - use m_Negative(APInt) helper. NFCI.
Simon Pilgrim [Thu, 8 Feb 2018 19:00:45 +0000 (19:00 +0000)]
[InstCombine] visitSRem - use m_Negative(APInt) helper. NFCI.

llvm-svn: 324636

6 years ago[InstCombine] Add vector udiv tests
Simon Pilgrim [Thu, 8 Feb 2018 18:58:00 +0000 (18:58 +0000)]
[InstCombine] Add vector udiv tests

Tests for X udiv C, where C >= signbit

llvm-svn: 324635

6 years ago[SelectionDAG] Add a helper function for creating a boolean constant based on the...
Craig Topper [Thu, 8 Feb 2018 18:55:14 +0000 (18:55 +0000)]
[SelectionDAG] Add a helper function for creating a boolean constant based on the target's boolean content

Many in SimplifySetCC and FoldSetCC try to create true or false constants. Some of them query getBooleanContents to figure out whether to use all ones or just 1 for true. But many places do not check and just use 1 without ensuring the VT has an i1 scalar type. Note sure if those places only trigger before type legalization so they only see an i1
type?

To cleanup the inconsistency and reduce some duplicated code, this patch adds a getBoolConstant method to SelectionDAG that takes are of querying getBooleanContents and doing the right thing.

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

llvm-svn: 324634

6 years agoSimplify function prototypes in bugpoint, NFC
Vedant Kumar [Thu, 8 Feb 2018 18:46:49 +0000 (18:46 +0000)]
Simplify function prototypes in bugpoint, NFC

llvm-svn: 324633

6 years agoChange "UNSUPPORTED: windows" to be "UNSUPPORTED: system-windows" so that test is...
Douglas Yung [Thu, 8 Feb 2018 18:45:16 +0000 (18:45 +0000)]
Change "UNSUPPORTED: windows" to be "UNSUPPORTED: system-windows" so that test is actually skipped on Windows.

Reviewed by Paul Robinson

llvm-svn: 324632

6 years ago[InstCombine] Add m_Negative pattern matching
Simon Pilgrim [Thu, 8 Feb 2018 18:36:01 +0000 (18:36 +0000)]
[InstCombine] Add m_Negative pattern matching

Allows us to add non-uniform constant vector support for "X urem C -> X < C ? X : X - C, where C >= signbit."

llvm-svn: 324631

6 years ago[X86] Add a few new test cases for shrunkblend combine
Craig Topper [Thu, 8 Feb 2018 18:34:25 +0000 (18:34 +0000)]
[X86] Add a few new test cases for shrunkblend combine

One of them shows a missed opportunity to use SimplifyDemandedBits on the condition when its used by multiple vselects.

The other is a case we shouldn't optimize because the condition has a non-vselect use.

llvm-svn: 324630

6 years ago[InstCombine] Add vector urem tests.
Simon Pilgrim [Thu, 8 Feb 2018 18:10:08 +0000 (18:10 +0000)]
[InstCombine] Add vector urem tests.

Improve coverage of InstCombiner::visitURem for vector types

llvm-svn: 324629

6 years agoUse ranged for loops in TypeFinder.cpp, NFC
Vedant Kumar [Thu, 8 Feb 2018 18:02:27 +0000 (18:02 +0000)]
Use ranged for loops in TypeFinder.cpp, NFC

llvm-svn: 324628

6 years ago[InstCombine] Regenerate vector mul tests.
Simon Pilgrim [Thu, 8 Feb 2018 17:54:24 +0000 (17:54 +0000)]
[InstCombine] Regenerate vector mul tests.

llvm-svn: 324627

6 years ago[LoopIdiom] Be more aggressive when setting alignment in memcpy
Daniel Neilson [Thu, 8 Feb 2018 17:33:08 +0000 (17:33 +0000)]
[LoopIdiom] Be more aggressive when setting alignment in memcpy

Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
LoopIdiom pass to cease using the old IRBuilder CreateMemCpy single-alignment APIs in
favour of the new API that allows setting source and destination alignments independently.
This allows us to be slightly more aggressive in setting the alignment of memcpy calls that
loop idiom creates.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, rL324148, rL324273, rL324278,
rL324384, rL324395, rL324402 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

llvm-svn: 324626

6 years agoFix signed/unsigned compare warning I introduced
Erich Keane [Thu, 8 Feb 2018 17:11:32 +0000 (17:11 +0000)]
Fix signed/unsigned compare warning I introduced

'size' of a vector is unsigned, and I accidentially compared
it to an int through GTEST.  I switched it to unsigned, which
is the template parameter type anyway.

llvm-svn: 324625

6 years agoOnce more, with feeling. Spell 'clang-4.0' correctly this time
Marshall Clow [Thu, 8 Feb 2018 17:06:08 +0000 (17:06 +0000)]
Once more, with feeling. Spell 'clang-4.0' correctly this time

llvm-svn: 324624

6 years ago[ARM] Add 'fillValidCPUArchList' to ARM targets
Erich Keane [Thu, 8 Feb 2018 16:48:54 +0000 (16:48 +0000)]
[ARM] Add 'fillValidCPUArchList' to ARM targets

This is a support change for a CFE change (https://reviews.llvm.org/D42978)
that allows march and -target-cpu to list the valid targets in a note. The changes
are limited to the ARM/AArch64, since this is the only target that gets the CPU
list from LLVM.

llvm-svn: 324623

6 years ago[dsymutil] Use llvm::sys::path to join bundle path.
Jonas Devlieghere [Thu, 8 Feb 2018 16:31:42 +0000 (16:31 +0000)]
[dsymutil] Use llvm::sys::path to join bundle path.

When processing a dSYM bundle, use llvm::sys::path to join the different
path components instead of using a string with hard coded forward
slashes as separators.

llvm-svn: 324622

6 years ago[dwarfdump] Normalize input path.
Jonas Devlieghere [Thu, 8 Feb 2018 16:31:01 +0000 (16:31 +0000)]
[dwarfdump] Normalize input path.

Before this patch, llvm-dwarfdump would reject `bundel.dSYM/` as input,
while `bundel.dSYM` was accepted. The reason is that `path::extension()`
returns an empty string for the former, leading to the argument not
being recognized as a dSYM bundle.

llvm-svn: 324621

6 years ago[scudo] Allow options to be defined at compile time
Kostya Kortchinsky [Thu, 8 Feb 2018 16:29:48 +0000 (16:29 +0000)]
[scudo] Allow options to be defined at compile time

Summary:
Allow for options to be defined at compile time, like is already the case for
other sanitizers, via `SCUDO_DEFAULT_OPTIONS`.

Reviewers: alekseyshl, dberris

Reviewed By: alekseyshl, dberris

Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers

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

llvm-svn: 324620

6 years agoClean up string's deduction guides tests. Mark old versions of clang as unsupported...
Marshall Clow [Thu, 8 Feb 2018 16:25:57 +0000 (16:25 +0000)]
Clean up string's deduction guides tests. Mark old versions of clang as unsupported, b/c they don't have deduction guides, even in C++17 mode

llvm-svn: 324619

6 years ago[clang-format] Do not break Objective-C string literals inside array literals
Ben Hamilton [Thu, 8 Feb 2018 16:07:25 +0000 (16:07 +0000)]
[clang-format] Do not break Objective-C string literals inside array literals

Summary:
Concatenating Objective-C string literals inside an array literal
raises the warning -Wobjc-string-concatenation (which is enabled by default).

clang-format currently splits and concatenates string literals like
the following:

  NSArray *myArray = @[ @"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ];

into:

  NSArray *myArray =
        @[ @"aaaaaaaaaaaaaaaaaaaaaaaaaaaa"
           @"aaaaaaaaa" ];

which raises the warning. This is https://bugs.llvm.org/show_bug.cgi?id=36153 .

The options I can think of to fix this are:

1) Have clang-format disable Wobjc-string-concatenation by emitting
pragmas around the formatted code
2) Have clang-format wrap the string literals in a macro (which
disables the warning)
3) Disable string splitting for Objective-C string literals inside
array literals

I think 1) has no precedent, and I couldn't find a good
identity() macro for 2). So, this diff implements 3).

Test Plan: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: jolesiak, stephanemoore, djasper

Reviewed By: jolesiak

Subscribers: klimek, cfe-commits

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

llvm-svn: 324618

6 years ago[AMDGPU] Updae documentation about address space
Yaxun Liu [Thu, 8 Feb 2018 15:41:19 +0000 (15:41 +0000)]
[AMDGPU] Updae documentation about address space

llvm-svn: 324617

6 years ago[SLPVectorizer] auto-generate complete checks; NFC
Sanjay Patel [Thu, 8 Feb 2018 15:32:28 +0000 (15:32 +0000)]
[SLPVectorizer] auto-generate complete checks; NFC

llvm-svn: 324616

6 years ago[SLPVectorizer] auto-generate complete checks; NFC
Sanjay Patel [Thu, 8 Feb 2018 15:30:39 +0000 (15:30 +0000)]
[SLPVectorizer] auto-generate complete checks; NFC

llvm-svn: 324615

6 years ago[SLPVectorizer] move RUN line to top-of-file; NFC
Sanjay Patel [Thu, 8 Feb 2018 15:28:49 +0000 (15:28 +0000)]
[SLPVectorizer] move RUN line to top-of-file; NFC

I was confused what we were checking because the RUN line was
in the middle of the file.

llvm-svn: 324614

6 years ago[InstCombine] Fix issue with X udiv (POW2_C1 << N) for non-splat constant vectors
Simon Pilgrim [Thu, 8 Feb 2018 15:19:38 +0000 (15:19 +0000)]
[InstCombine] Fix issue with X udiv (POW2_C1 << N) for non-splat constant vectors

foldUDivShl was assuming that the input was a scalar or a splat constant

llvm-svn: 324613

6 years ago[SLPVectorizer] auto-generate complete checks; NFC
Sanjay Patel [Thu, 8 Feb 2018 15:16:26 +0000 (15:16 +0000)]
[SLPVectorizer] auto-generate complete checks; NFC

llvm-svn: 324612

6 years ago[LoopVectorize] auto-generate complete checks; NFC
Sanjay Patel [Thu, 8 Feb 2018 15:13:47 +0000 (15:13 +0000)]
[LoopVectorize] auto-generate complete checks; NFC

llvm-svn: 324611

6 years ago[ValueTracking] don't crash when assumptions conflict (PR36270)
Sanjay Patel [Thu, 8 Feb 2018 14:52:40 +0000 (14:52 +0000)]
[ValueTracking] don't crash when assumptions conflict (PR36270)

The last assume in the test says that %B12 is 0.
The first assume says that %and1 is less than %B12.
Therefore, %and1 is unsigned less than 0...does not compute.

That means this line:
Known.Zero.setHighBits(RHSKnown.countMinLeadingZeros() + 1);
...tries to set more bits than exist.

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

llvm-svn: 324610

6 years agoUpdate the status of removed components
Marshall Clow [Thu, 8 Feb 2018 14:51:22 +0000 (14:51 +0000)]
Update the status of removed components

llvm-svn: 324609

6 years ago[InstCombine] Fix issue with X udiv 2^C -> X >> C for non-splat constant vectors
Simon Pilgrim [Thu, 8 Feb 2018 14:46:10 +0000 (14:46 +0000)]
[InstCombine] Fix issue with X udiv 2^C -> X >> C for non-splat constant vectors

foldUDivPow2Cst was assuming that the input was a scalar or a splat constant

llvm-svn: 324608

6 years ago[Parser][FixIt] Better diagnostics for "typedef" instead of "typename" typo
Jan Korous [Thu, 8 Feb 2018 14:37:58 +0000 (14:37 +0000)]
[Parser][FixIt] Better diagnostics for "typedef" instead of "typename" typo

rdar://problem/10214588

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

llvm-svn: 324607

6 years ago[ARM] Re-commit r324600 with fixed LLVMBuild.txt
Oliver Stannard [Thu, 8 Feb 2018 14:31:22 +0000 (14:31 +0000)]
[ARM] Re-commit r324600 with fixed LLVMBuild.txt

ARMDisassembler now depends on the banked register tables in ARMUtils, so the
LLVMBuild.txt needed updating to reflect this.

Original commit mesage:

[ARM] Fix disassembly of invalid banked register moves

When disassembling banked register move instructions, we don't have an
assembly syntax for the unallocated register numbers, so we have to
return Fail rather than SoftFail. Previously we were returning SoftFail,
then crashing in the InstPrinter as we have no way to represent these
encodings in an assembly string.

This also switches the decoder to use the table-generated list of banked
registers, removing the duplicated list of encodings.

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

llvm-svn: 324606

6 years agoFix unused variable warning.
Simon Pilgrim [Thu, 8 Feb 2018 14:24:26 +0000 (14:24 +0000)]
Fix unused variable warning.

llvm-svn: 324605

6 years agoRevert r324600 as it breaks a buildbot
Oliver Stannard [Thu, 8 Feb 2018 14:21:28 +0000 (14:21 +0000)]
Revert r324600 as it breaks a buildbot

The broken bot (clang-ppc64le-linux-multistage) is doign a shared-object build,
so I guess using lookupBankedRegByEncoding in the disassembler is a layering
violation?

llvm-svn: 324604

6 years ago[InstCombine] Improve mul(x, pow2) -> shl combine for vector constants
Simon Pilgrim [Thu, 8 Feb 2018 14:10:01 +0000 (14:10 +0000)]
[InstCombine] Improve mul(x, pow2) -> shl combine for vector constants

Refactor getLogBase2Vector into getLogBase2 to accept all scalars/vectors. Generalize from ConstantDataVector to support all constant vectors.

llvm-svn: 324603

6 years ago[x86] Add test/CodeGen/X86/vmaskmov-offset.ll. NFC.
Alexander Ivchenko [Thu, 8 Feb 2018 13:16:42 +0000 (13:16 +0000)]
[x86] Add test/CodeGen/X86/vmaskmov-offset.ll. NFC.

Needed for checking current code generation.

llvm-svn: 324601

6 years ago[ARM] Fix disassembly of invalid banked register moves
Oliver Stannard [Thu, 8 Feb 2018 13:06:08 +0000 (13:06 +0000)]
[ARM] Fix disassembly of invalid banked register moves

When disassembling banked register move instructions, we don't have an
assembly syntax for the unallocated register numbers, so we have to
return Fail rather than SoftFail. Previously we were returning SoftFail,
then crashing in the InstPrinter as we have no way to represent these
encodings in an assembly string.

This also switches the decoder to use the table-generated list of banked
registers, removing the duplicated list of encodings.

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

llvm-svn: 324600

6 years ago[clangd] Update include guard in Annotations.h. NFC
Ilya Biryukov [Thu, 8 Feb 2018 12:46:34 +0000 (12:46 +0000)]
[clangd] Update include guard in Annotations.h. NFC

llvm-svn: 324599

6 years ago[test][dsymutil] Fix tests for Windows bots.
Jonas Devlieghere [Thu, 8 Feb 2018 11:58:16 +0000 (11:58 +0000)]
[test][dsymutil] Fix tests for Windows bots.

The UNSUPPORTED directive was not honored by the bot, presumably because
of the FIXME above it. This moves the comment down and removes the
remaining update check from basic-linking-x86.test.

This should un-break: llvm-clang-x86_64-expensive-checks-win/builds/7798/

llvm-svn: 324598

6 years agoAdd missed PostDominatorTree analysis dependency to GVN hoist pass.
Alexander Ivchenko [Thu, 8 Feb 2018 11:45:36 +0000 (11:45 +0000)]
Add missed PostDominatorTree analysis dependency to GVN hoist pass.

Summary:
GVN hoist pass is using PostDominatorTree analysis, therefore the analysis
should be listed in the pass initialization as a dependency.

Reviewed By: sebpop

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

Author: ashlykov <arkady.shlykov@intel.com>
llvm-svn: 324597

6 years ago[libcxx] Avoid spurious construction of valarray elements
Mikhail Maltsev [Thu, 8 Feb 2018 11:33:48 +0000 (11:33 +0000)]
[libcxx] Avoid spurious construction of valarray elements

Summary:
Currently libc++ implements some operations on valarray by using the
resize method. This method has a parameter with a default value.
Because of this, valarray may spuriously construct and destruct
objects of valarray's element type.

This patch fixes this issue and adds corresponding test cases.

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: rogfer01, cfe-commits

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

llvm-svn: 324596

6 years ago[X86][MC]: Adding test coverage of MC encoding for several small extensions.<NFC>
Gadi Haber [Thu, 8 Feb 2018 11:16:02 +0000 (11:16 +0000)]
[X86][MC]: Adding test coverage of MC encoding for several small extensions.<NFC>

NFC.
 Adding MC regressions tests to cover several small x86 extensions as follows:
 CLWB, CLZERO, F16C, INVPCID, PKU, POPCNT, RTM, SGX, SHA, SVM, VMFUNC, VTX

This patch is part of a larger task to cover MC encoding of all X86 isa sets started in revision: https://reviews.llvm.org/D39952

Reviewers: RKSimon, craig.topper, zvi, AndreiGrischenko
Differential Revision: https://reviews.llvm.org/D41388

Change-Id: I254508cd17faca00b780be0fc2abf6c71b61faab
llvm-svn: 324595

6 years agoFix for #31362 - ms_abi is implemented incorrectly for values >=16 bytes.
Alexander Ivchenko [Thu, 8 Feb 2018 11:15:21 +0000 (11:15 +0000)]
Fix for #31362 - ms_abi is implemented incorrectly for values >=16 bytes.

Summary:
This patch is a fix for following issue:
https://bugs.llvm.org/show_bug.cgi?id=31362 The problem was caused by front end
lowering C calling conventions without taking into account calling conventions
enforced by attribute. In this case win64cc was no correctly lowered on targets
other than Windows.

Reviewed By: rnk (Reid Kleckner)

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

Author: belickim <mateusz.belicki@intel.com>
llvm-svn: 324594

6 years ago[builtins] Workaround for infinite recursion in c?zdi2
Jonas Devlieghere [Thu, 8 Feb 2018 11:14:11 +0000 (11:14 +0000)]
[builtins] Workaround for infinite recursion in c?zdi2

gcc resolves `__builtin_c?z` to `__c?zdi2` which leads to infinite
recursion. This problem has been observed for sparc64, mips64 and riscv.
Presumably this happens whenever an arch without dedicated bit counting
instructions is targeted. This patch provides a workaround.

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

llvm-svn: 324593

6 years agoRe-land [dsymutil] Upstream update feature
Jonas Devlieghere [Thu, 8 Feb 2018 10:48:54 +0000 (10:48 +0000)]
Re-land [dsymutil] Upstream update feature

This commit attempts to re-land the r324480 which was reverted in
r324493 because it broke the Windows bots. For now I disabled the two
update tests on Windows until I'm able to debug this.

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

llvm-svn: 324592

6 years ago[clang-format] Do not break before long string literals in protos
Krasimir Georgiev [Thu, 8 Feb 2018 10:47:12 +0000 (10:47 +0000)]
[clang-format] Do not break before long string literals in protos

Summary:
This patch is a follow-up to r323319 (which disables string literal breaking for
text protos) and it disables breaking before long string literals.

For example this:
```
keyyyyy: "long string literal"
```
used to get broken into:
```
keyyyyy:
    "long string literal"
```

While at it, I also enabled it for LK_Proto and fixed a bug in the mustBreak code.

Reviewers: djasper, sammccall

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 324591

6 years agoRewrite the flaky test_restart_bug test in a more deterministic way
Pavel Labath [Thu, 8 Feb 2018 10:37:23 +0000 (10:37 +0000)]
Rewrite the flaky test_restart_bug test in a more deterministic way

Summary:
The test was trying to reproduce a bug in handling of two concurrent
events, which was impossible to do reliably in a black-box style test.
In practice, this meant the test was only ever failing on remote
targets, as these were slow enough to trigger this.

Fortunately, we now have the ability to mock the server side of the
connection, which means we can simulate the failure deterministically,
so I rewrite the test to use the new gdb-client framework.

I've needed to add a couple of new packets to the mock server to be able
to do this. Instead of trying to guess how a "typical" gdb-client test
will want to handle this, I throw an exception in the implementation to
force the user to override them (the packets are only sent if the test
explicitly performs some action which will trigger them, so a basic test
which e.g. does not need the "continue" functionality will not need to
implement them).

Reviewers: owenpshaw

Subscribers: srhines, lldb-commits

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

llvm-svn: 324590

6 years ago[Loop Predication] Teach LP about reverse loops with uge and sge latch conditions
Serguei Katkov [Thu, 8 Feb 2018 10:34:08 +0000 (10:34 +0000)]
[Loop Predication] Teach LP about reverse loops with uge and sge latch conditions

Add support of uge and sge latch condition to Loop Prediction for
reverse loops.

Reviewers: apilipenko, mkazantsev, sanjoy, anna
Reviewed By: anna
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D42837

llvm-svn: 324589

6 years ago[OMPT] Add tool_available_search testcase
Joachim Protze [Thu, 8 Feb 2018 10:04:33 +0000 (10:04 +0000)]
[OMPT] Add tool_available_search testcase

Tests the search for tools as defined in the spec. The OMP_TOOL_LIBRARIES
environment variable contains paths to the following files(in that order)

-to a nonexisting file
-to a shared library that does not have a ompt_start_tool function
-to a shared library that has an ompt_start_tool implementation returning NULL
-to a shared library that has an ompt_start_tool implementation returning a
    pointer to a valid instance of ompt_start_tool_result_t

The expected result is that the last tool gets active and can print in the
thread-begin callback.

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

llvm-svn: 324588

6 years ago[OMPT] Add tool_not_available testcase
Joachim Protze [Thu, 8 Feb 2018 10:04:28 +0000 (10:04 +0000)]
[OMPT] Add tool_not_available testcase

Add a testcase that checks wheter the runtime can handle an ompt_start_tool
method that returns NULL indicating that no tool shall be loaded.

All tool_available testcases need a separate folder to avoid file conflicts for
the generated tools.

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

llvm-svn: 324587

6 years ago[X86] Fix compilation of r324580.
Clement Courbet [Thu, 8 Feb 2018 09:41:50 +0000 (09:41 +0000)]
[X86] Fix compilation of r324580.

@ctopper Can you check that the fix is correct ?

llvm-svn: 324586