platform/upstream/llvm.git
6 years ago[ADT] Simplify getMemory. NFC
Fangrui Song [Fri, 23 Mar 2018 17:26:12 +0000 (17:26 +0000)]
[ADT] Simplify getMemory. NFC

llvm-svn: 328334

6 years ago[Hexagon] Copy subregisters in HexagonStoreWiden
Krzysztof Parzyszek [Fri, 23 Mar 2018 17:22:55 +0000 (17:22 +0000)]
[Hexagon] Copy subregisters in HexagonStoreWiden

When converting an instruction to the wider version, copy any
subregisters if the original operand has a subregister.

Patch by Brendon Cahoon.

llvm-svn: 328333

6 years agoAdd a minimal fix for PR36878.
Rafael Espindola [Fri, 23 Mar 2018 17:19:18 +0000 (17:19 +0000)]
Add a minimal fix for PR36878.

When looking for the output section and the output offset the
expectation was that the caller had looked at Repl. That works fine
for InputSections, but in the case of MergeInputSections the caller
doesn't have the section that is actually replaced.

The original testcase was failing because getOutputSection was
returning null. The slightly extended testcase also checks that
getOffset also checks Repl.

I will send a refactoring separetelly.

llvm-svn: 328332

6 years ago[X86][Btver2] Vector permutes use a JFPU01 scheduler pipe and JFPX/JVALU function...
Simon Pilgrim [Fri, 23 Mar 2018 16:17:56 +0000 (16:17 +0000)]
[X86][Btver2] Vector permutes use a JFPU01 scheduler pipe and JFPX/JVALU function unit

llvm-svn: 328331

6 years ago[InstCombine] auto-generate checks; NFC
Sanjay Patel [Fri, 23 Mar 2018 15:39:03 +0000 (15:39 +0000)]
[InstCombine] auto-generate checks; NFC

llvm-svn: 328329

6 years ago[X86][Btver2] Vector store instructions use a JFPU1 scheduler pipe and JSAGU/JSTC...
Simon Pilgrim [Fri, 23 Mar 2018 15:35:13 +0000 (15:35 +0000)]
[X86][Btver2] Vector store instructions use a JFPU1 scheduler pipe and JSAGU/JSTC function units

llvm-svn: 328328

6 years ago[InstSimplify] regenerate checks, move tests; NFC
Sanjay Patel [Fri, 23 Mar 2018 15:31:31 +0000 (15:31 +0000)]
[InstSimplify] regenerate checks, move tests; NFC

llvm-svn: 328327

6 years agoRe-commit: [MachineLICM] Add functions to MachineLICM to hoist invariant stores
Zaara Syeda [Fri, 23 Mar 2018 15:28:15 +0000 (15:28 +0000)]
Re-commit: [MachineLICM] Add functions to MachineLICM to hoist invariant stores

This patch adds functions to allow MachineLICM to hoist invariant stores.
Currently, MachineLICM does not hoist any store instructions, however
when storing the same value to a constant spot on the stack, the store
instruction should be considered invariant and be hoisted. The function
isInvariantStore iterates each operand of the store instruction and checks
that each register operand satisfies isCallerPreservedPhysReg. The store
may be fed by a copy, which is hoisted by isCopyFeedingInvariantStore.
This patch also adds the PowerPC changes needed to consider the stack
register as caller preserved.

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

llvm-svn: 328326

6 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Fri, 23 Mar 2018 15:19:35 +0000 (15:19 +0000)]
[InstCombine] regenerate test checks; NFC

llvm-svn: 328325

6 years ago[X86][Btver2] Cleanup DPPS/DPPD instructions to use JFPA/JFPM function units
Simon Pilgrim [Fri, 23 Mar 2018 15:17:50 +0000 (15:17 +0000)]
[X86][Btver2] Cleanup DPPS/DPPD instructions to use JFPA/JFPM function units

llvm-svn: 328324

6 years ago[InstCombine] reduce code duplication; NFC
Sanjay Patel [Fri, 23 Mar 2018 15:07:35 +0000 (15:07 +0000)]
[InstCombine] reduce code duplication; NFC

llvm-svn: 328323

6 years ago[InstCombine] improve variable name; NFC
Sanjay Patel [Fri, 23 Mar 2018 14:48:31 +0000 (14:48 +0000)]
[InstCombine] improve variable name; NFC

llvm-svn: 328322

6 years ago[AArch64] Don't reduce the width of loads if it prevents combining a shift
John Brawn [Fri, 23 Mar 2018 14:47:07 +0000 (14:47 +0000)]
[AArch64] Don't reduce the width of loads if it prevents combining a shift

Loads and stores can only shift the offset register by the size of the value
being loaded, but currently the DAGCombiner will reduce the width of the load
if it's followed by a trunc making it impossible to later combine the shift.

Solve this by implementing shouldReduceLoadWidth for the AArch64 backend and
make it prevent the width reduction if this is what would happen, though do
allow it if reducing the load width will let us eliminate a later sign or zero
extend.

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

llvm-svn: 328321

6 years ago[X86][Btver2] Fix MicroOps counts for DPPS/YMM memory folded instructions
Simon Pilgrim [Fri, 23 Mar 2018 14:45:03 +0000 (14:45 +0000)]
[X86][Btver2] Fix MicroOps counts for DPPS/YMM memory folded instructions

This was due to a misunderstanding over what llvm calls a micro-op (retirement unit) is actually called a macro-op on the AMD/Jaguar target. Folded loads don't affect num macro ops.

llvm-svn: 328320

6 years ago[ELF] - Simplify. NFC.
George Rimar [Fri, 23 Mar 2018 14:43:51 +0000 (14:43 +0000)]
[ELF] - Simplify. NFC.

llvm-svn: 328319

6 years ago[X86][Btver2] Cleanup SSE42 PCMPISTR/PCMPESTR string instructions to correctly use...
Simon Pilgrim [Fri, 23 Mar 2018 14:27:26 +0000 (14:27 +0000)]
[X86][Btver2] Cleanup SSE42 PCMPISTR/PCMPESTR string instructions to correctly use JFPU1 scheduler pipe followed by JLAGU/JSAGU/JFPA/JVALU function units

Fixes throughput to match Agner/Fam16h-SoG as well.

llvm-svn: 328318

6 years agoRemove the deprecated single-alignment IRBuilder API for memcpy/memmove (NFC)
Daniel Neilson [Fri, 23 Mar 2018 14:25:35 +0000 (14:25 +0000)]
Remove the deprecated single-alignment IRBuilder API for memcpy/memmove (NFC)

Summary:
This change is part of step six in the series of changes to remove the alignment
argument from memcpy/memmove/memset in favour of alignment attributes. At this
point all users of the IRBuilder APIs for creating a memcpy/memmove call given
a single value for alignment have been updated. We want to discourage usage of
these old APIs in favour of the newer ones that allow for separate source and
destination alignments, so this patch deletes the old API.

Specifically, we remove from IRBuilder:
CallInst *CreateMemCpy(Value *Dst, Value *Src, uint64_t Size, unsigned Align,
                       bool isVolatile = false, MDNode *TBAATag = nullptr,
                       MDNode *TBAAStructTag = nullptr,
                       MDNode *ScopeTag = nullptr,
                       MDNode *NoAliasTag = nullptr)
CallInst *CreateMemCpy(Value *Dst, Value *Src, Value *Size, unsigned Align,
                       bool isVolatile = false, MDNode *TBAATag = nullptr,
                       MDNode *TBAAStructTag = nullptr,
                       MDNode *ScopeTag = nullptr,
                       MDNode *NoAliasTag = nullptr)
CallInst *CreateMemMove(Value *Dst, Value *Src, uint64_t Size, unsigned Align,
                        bool isVolatile = false, MDNode *TBAATag = nullptr,
                        MDNode *ScopeTag = nullptr,
                        MDNode *NoAliasTag = nullptr)
CallInst *CreateMemMove(Value *Dst, Value *Src, Value *Size, unsigned Align,
                        bool isVolatile = false, MDNode *TBAATag = nullptr,
                        MDNode *ScopeTag = nullptr,
                        MDNode *NoAliasTag = nullptr)

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, rL324654, rL324773, rL324774,
rL324781, rL324784, rL324955, rL324960, rL325816, rL327398, rL327421, rL328097 )
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: 328317

6 years ago[SLP] Stop counting cost of gather sequences with multiple uses
Matthew Simpson [Fri, 23 Mar 2018 14:18:27 +0000 (14:18 +0000)]
[SLP] Stop counting cost of gather sequences with multiple uses

When building the SLP tree, we look for reuse among the vectorized tree
entries. However, each gather sequence is represented by a unique tree entry,
even though the sequence may be identical to another one. This means, for
example, that a gather sequence with two uses will be counted twice when
computing the cost of the tree. We should only count the cost of the definition
of a gather sequence rather than its uses. During code generation, the
redundant gather sequences are emitted, but we optimize them away with CSE. So
it looks like this problem just affects the cost model.

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

llvm-svn: 328316

6 years agoRemove deprecated MemIntrinsic methods (NFC)
Daniel Neilson [Fri, 23 Mar 2018 14:02:54 +0000 (14:02 +0000)]
Remove deprecated MemIntrinsic methods (NFC)

Summary:
This change is part of step six in the series of changes to remove
the alignment argument from memcpy/memmove/memset in favour of
alignment attributes. At this point all uses of
MemIntrinsicInst::[get|set]Alignment() have been updated, so we now
remove these methods entirely to discourage their use.

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, rL324654, rL324773, rL324774,
rL324781, rL324784, rL324955, rL324960, rL325816, rL327398, rL327421, rL328097 )
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: 328315

6 years ago[DEBUGINFO] Add flag for DWARF2 to use sections as references.
Alexey Bataev [Fri, 23 Mar 2018 13:35:54 +0000 (13:35 +0000)]
[DEBUGINFO] Add flag for DWARF2 to use sections as references.

Summary:
Some targets does not support labels inside debug sections, but support
references in form `section+offset`. Patch adds initial support
for this.

Reviewers: echristo, probinson, jlebar

Subscribers: llvm-commits, JDevlieghere

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

llvm-svn: 328314

6 years ago[ARM] Support float literals under XO
Christof Douma [Fri, 23 Mar 2018 13:02:03 +0000 (13:02 +0000)]
[ARM] Support float literals under XO

When targeting execute-only and fp-armv8, float constants in a compare
resulted in instruction selection failures. This is now fixed by using
vmov.f32 where possible, otherwise the floating point constant is
lowered into a integer constant that is moved into a floating point
register.

This patch also restores using fpcmp with immediate 0 under fp-armv8.

Change-Id: Ie87229706f4ed879a0c0cf66631b6047ed6c6443
llvm-svn: 328313

6 years agoRevert r328307: [IPSCCP] Use constant range information for comparisons of parameters.
Florian Hahn [Fri, 23 Mar 2018 12:49:39 +0000 (12:49 +0000)]
Revert r328307: [IPSCCP] Use constant range information for comparisons of parameters.

Reverted for now, due to it causing verifier failures.

llvm-svn: 328312

6 years ago[GlobalISel] Fix legalizer combine to not use illegal input G_EXTRACT.
Amara Emerson [Fri, 23 Mar 2018 12:48:57 +0000 (12:48 +0000)]
[GlobalISel] Fix legalizer combine to not use illegal input G_EXTRACT.

This was being masked because GISel is enabled by default for -O0 and
the abort was disabled. Modified test to explicitly enable abort.

llvm-svn: 328311

6 years ago[test] Allow for optional No-Op Barrier Pass in O0 pipeline
Matthew Simpson [Fri, 23 Mar 2018 12:47:54 +0000 (12:47 +0000)]
[test] Allow for optional No-Op Barrier Pass in O0 pipeline

llvm-svn: 328310

6 years ago[X86][Znver1] Fix instregex entries that don't match any instructions (D44687)
Simon Pilgrim [Fri, 23 Mar 2018 12:08:23 +0000 (12:08 +0000)]
[X86][Znver1] Fix instregex entries that don't match any instructions (D44687)

Reviewed by @GGanesh and @craig.topper

llvm-svn: 328309

6 years ago[X86][SandyBridge] Fix missing comma that was causing string concatenation of 2 instr...
Simon Pilgrim [Fri, 23 Mar 2018 11:56:38 +0000 (11:56 +0000)]
[X86][SandyBridge] Fix missing comma that was causing string concatenation of 2 instregex entries

Found while updating D44687

llvm-svn: 328308

6 years ago[IPSCCP] Use constant range information for comparisons of parameters.
Florian Hahn [Fri, 23 Mar 2018 11:56:00 +0000 (11:56 +0000)]
[IPSCCP] Use constant range information for comparisons of parameters.

For comparisons with parameters, we can use the ParamState lattice
elements which also provide constant range information. This improves
the code for PR33253 further and gets us closer to use
ValueLatticeElement for all values.

Also, as we are using the range information in the solver directly, we
do not need tryToReplaceWithConstantRange afterwards anymore.

Reviewers: dberlin, mssimpso, davide, efriedma

Reviewed By: mssimpso

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

llvm-svn: 328307

6 years ago[llvm-mca] Pass the InstrBuilder to the constructor of Backend.
Andrea Di Biagio [Fri, 23 Mar 2018 11:50:43 +0000 (11:50 +0000)]
[llvm-mca] Pass the InstrBuilder to the constructor of Backend.

This is done in preparation for the fix for PR36784.
No functional change.

llvm-svn: 328306

6 years ago[llvm-mca] Add flag -resource-pressure to enable/disable printing of the resource...
Andrea Di Biagio [Fri, 23 Mar 2018 11:33:09 +0000 (11:33 +0000)]
[llvm-mca] Add flag -resource-pressure to enable/disable printing of the resource pressure view.

By default, the tool always enables the resource pressure view.
This flag lets user specify whether they want to add that view or not.

llvm-svn: 328305

6 years ago[X86][Btver2] Vector move/load/store instructions use a JFPU01 scheduler pipe and...
Simon Pilgrim [Fri, 23 Mar 2018 11:27:31 +0000 (11:27 +0000)]
[X86][Btver2] Vector move/load/store instructions use a JFPU01 scheduler pipe and JFPX/JVALU function unit as well as the AGUs

llvm-svn: 328304

6 years ago[AArch64] Clean-up a few over-eager regexps in models.
Florian Hahn [Fri, 23 Mar 2018 11:00:42 +0000 (11:00 +0000)]
[AArch64] Clean-up a few over-eager regexps in models.

Patch by Simon Pilgrim <llvm-dev@redking.me.uk>

That is a slightly modified version of the AArch64 changes from
Simon's D44687 .

llvm-svn: 328303

6 years ago[clangd] Remove 'static' from a function inside anonymous ns. NFC
Ilya Biryukov [Fri, 23 Mar 2018 10:39:15 +0000 (10:39 +0000)]
[clangd] Remove 'static' from a function inside anonymous ns. NFC

llvm-svn: 328302

6 years ago[LoopUnroll] Simplify induction variables after peeling too.
Florian Hahn [Fri, 23 Mar 2018 10:38:12 +0000 (10:38 +0000)]
[LoopUnroll] Simplify induction variables after peeling too.

Loop peeling also has an impact on the induction variables, so we should
benefit from induction variable simplification after peeling too.

Reviewers: sanjoy, bogner, mzolotukhin, efriedma

Reviewed By: efriedma

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

llvm-svn: 328301

6 years ago[ORC] Join materialization thread in unit test
Benjamin Kramer [Fri, 23 Mar 2018 10:14:19 +0000 (10:14 +0000)]
[ORC] Join materialization thread in unit test

There's are race between this thread and the destructor of the test ORC
components on the main threads. I saw flaky failures there in about 4%
of the runs of this unit test.

llvm-svn: 328300

6 years ago[ELF] - Another fix for "LLD crashes with --emit-relocs when trying to proccess ...
George Rimar [Fri, 23 Mar 2018 09:18:31 +0000 (09:18 +0000)]
[ELF] - Another fix for "LLD crashes with --emit-relocs when trying to proccess .eh_frame"

This fixes PR36367 which is about segfault when --emit-relocs is
used together with .eh_frame sections which happens because
of reordering of regular and .rel[a] sections.

Path changes loop that iterates over input sections to create
relocation target sections first.

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

llvm-svn: 328299

6 years ago[ARM] Error out on .arm assembler directives on windows
Martin Storsjo [Fri, 23 Mar 2018 09:10:03 +0000 (09:10 +0000)]
[ARM] Error out on .arm assembler directives on windows

Windows on arm is thumb only.

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

llvm-svn: 328298

6 years agoRevert "[DAGCombiner] Fold (zext (and/or/xor (shl/shr (load x), cst), cst))"
Martin Storsjo [Fri, 23 Mar 2018 08:36:47 +0000 (08:36 +0000)]
Revert "[DAGCombiner] Fold (zext (and/or/xor (shl/shr (load x), cst), cst))"

This reverts commit r328252. This change broke building a number
of projects when targeting ARM and AArch64, see PR36873.

llvm-svn: 328297

6 years ago[X86] Give VPCMPEQQ the same itinerary as its SSE counterpart.
Craig Topper [Fri, 23 Mar 2018 06:58:55 +0000 (06:58 +0000)]
[X86] Give VPCMPEQQ the same itinerary as its SSE counterpart.

llvm-svn: 328296

6 years ago[X86] Correct the latencies of SNB integer vector multiplies based on Agner's data...
Craig Topper [Fri, 23 Mar 2018 06:41:43 +0000 (06:41 +0000)]
[X86] Correct the latencies of SNB integer vector multiplies based on Agner's data. Add missing MMX multiplies.

llvm-svn: 328295

6 years ago[X86] Match vpblendvb/vblendvps/vblendvpd itineraries to the SSE equivalent. Change...
Craig Topper [Fri, 23 Mar 2018 06:41:41 +0000 (06:41 +0000)]
[X86] Match vpblendvb/vblendvps/vblendvpd itineraries to the SSE equivalent. Change pblendvb/blendvps/blendvpd to use WriteFVarBlend

llvm-svn: 328294

6 years ago[X86] Change VPSADBW itinerary to SSE_INTALU_ITINS_P to match the SSE version.
Craig Topper [Fri, 23 Mar 2018 06:41:40 +0000 (06:41 +0000)]
[X86] Change VPSADBW itinerary to SSE_INTALU_ITINS_P to match the SSE version.

llvm-svn: 328293

6 years ago[X86] Give VLDDQUrm and LDDQUrm the same itinerary.
Craig Topper [Fri, 23 Mar 2018 06:41:39 +0000 (06:41 +0000)]
[X86] Give VLDDQUrm and LDDQUrm the same itinerary.

llvm-svn: 328292

6 years ago[X86] Merge VMOVMSKBrr and MOVMSKBrr in the SNB sheduler model.
Craig Topper [Fri, 23 Mar 2018 06:41:38 +0000 (06:41 +0000)]
[X86] Merge VMOVMSKBrr and MOVMSKBrr in the SNB sheduler model.

The VMOVMSKBrr was in a separate InstRW with a lower latency, but I assume they should be the same and the higher latency matches Agners table so I'm going with that.

llvm-svn: 328291

6 years ago[X86] Add VEXTRB/W/D/Q to Zen scheduler model.
Craig Topper [Fri, 23 Mar 2018 06:41:36 +0000 (06:41 +0000)]
[X86] Add VEXTRB/W/D/Q to Zen scheduler model.

The SSE versions were present, but not the VEX version.

llvm-svn: 328290

6 years ago[X86] Fix the itinerary for vextractps to match extractps.
Craig Topper [Fri, 23 Mar 2018 06:41:35 +0000 (06:41 +0000)]
[X86] Fix the itinerary for vextractps to match extractps.

llvm-svn: 328289

6 years agoBring r328238 back with a fix.
Rafael Espindola [Fri, 23 Mar 2018 01:36:23 +0000 (01:36 +0000)]
Bring r328238 back with a fix.

The issues was that we were setting hidden visibility if, when
processing a hidden class, we found out that we needed to emit a
reference to a vtable provided by the standard library.

Original message:

Set dso_local on vtables.

llvm-svn: 328288

6 years ago[DAG] Fix node id invalidation in Instruction Selection.
Nirav Dave [Fri, 23 Mar 2018 01:22:39 +0000 (01:22 +0000)]
[DAG] Fix node id invalidation in Instruction Selection.

Invalidation should be bit negation. Add missing negation.

llvm-svn: 328287

6 years agoRemove problematic PrettyStackTrace entry added in r328276
Jordan Rose [Fri, 23 Mar 2018 01:12:09 +0000 (01:12 +0000)]
Remove problematic PrettyStackTrace entry added in r328276

I'm not sure /why/ this is causing issues for libclang, but it is.
Unbreak the buildbots since it's already consumed an hour of my time.

llvm-svn: 328286

6 years agoFix the MSVC build.
Rafael Espindola [Fri, 23 Mar 2018 00:42:47 +0000 (00:42 +0000)]
Fix the MSVC build.

llvm-svn: 328285

6 years agoFix PR36793.
Rafael Espindola [Fri, 23 Mar 2018 00:35:27 +0000 (00:35 +0000)]
Fix PR36793.

With this patch lld will iterate over compile units to find the line
tables instead of assuming there is only one at offset 0.

llvm-svn: 328284

6 years ago[Modules] Update test to mention it requires C++14.
Volodymyr Sapsai [Fri, 23 Mar 2018 00:16:06 +0000 (00:16 +0000)]
[Modules] Update test to mention it requires C++14.

llvm-svn: 328283

6 years ago[analyzer] Trust _Nonnull annotations for system framework
George Karpenkov [Fri, 23 Mar 2018 00:16:03 +0000 (00:16 +0000)]
[analyzer] Trust _Nonnull annotations for system framework

Changes the analyzer to believe that methods annotated with _Nonnull
from system frameworks indeed return non null objects.
Local methods with such annotation are still distrusted.
rdar://24291919

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

llvm-svn: 328282

6 years ago[analyzer] Extend GCDAntipatternChecker to match group_enter/group_leave pattern
George Karpenkov [Fri, 23 Mar 2018 00:16:02 +0000 (00:16 +0000)]
[analyzer] Extend GCDAntipatternChecker to match group_enter/group_leave pattern

rdar://38480416

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

llvm-svn: 328281

6 years ago[analyzer] [NFC] Move worklist implementation to WorkList.cpp
George Karpenkov [Fri, 23 Mar 2018 00:16:01 +0000 (00:16 +0000)]
[analyzer] [NFC] Move worklist implementation to WorkList.cpp

Current location is very confusing, especially because there is already
WorkList.h, and other code in CoreEngine.cpp is not related to work list
implementation.

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

llvm-svn: 328280

6 years ago[sanitizer] Fix PPC bot
Vitaly Buka [Fri, 23 Mar 2018 00:15:10 +0000 (00:15 +0000)]
[sanitizer] Fix PPC bot

llvm-svn: 328279

6 years ago[CommandObjectFrame] Remove dead code.
Davide Italiano [Fri, 23 Mar 2018 00:14:41 +0000 (00:14 +0000)]
[CommandObjectFrame] Remove dead code.

llvm-svn: 328278

6 years ago[ARM] Add ARMv8.2-A FP16 vector intrinsic
Abderrazek Zaafrani [Fri, 23 Mar 2018 00:08:40 +0000 (00:08 +0000)]
[ARM] Add ARMv8.2-A FP16 vector intrinsic

Putting back the code in commit r327189 that was reverted in r322737. The code is being committed in three stages and this one is the last stage: 1) r327455 fp16 feature flags, 2) r327836 pass half type or i16 based on FullFP16, and 3) the code here which the front-end fp16 vector intrinsic for ARM.

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

llvm-svn: 328277

6 years agoSink PrettyDeclStackTrace down to the AST library
Jordan Rose [Fri, 23 Mar 2018 00:07:18 +0000 (00:07 +0000)]
Sink PrettyDeclStackTrace down to the AST library

...and add some very basic stack trace entries for module building.
This would have helped track down rdar://problem/38434694 sooner.

llvm-svn: 328276

6 years ago[TableGen] Don't capture returned std::vectors by const reference.
Craig Topper [Fri, 23 Mar 2018 00:02:45 +0000 (00:02 +0000)]
[TableGen] Don't capture returned std::vectors by const reference.

The full vector is being returned not a reference. So the reference was just a to a temporary.

llvm-svn: 328275

6 years agoFor llvm-nm and Mach-O files also use function starts info in some
Kevin Enderby [Thu, 22 Mar 2018 23:59:35 +0000 (23:59 +0000)]
For llvm-nm and Mach-O files also use function starts info in some
cases when printing symbols.  As an improvement to:

r305733 - Change llvm-nm for Mach-O files to use dyld info in some cases when printing symbols

it could be made a bit better if it also read the function starts and faked
up nlist entries to those address not already faked up by the other
dyld info.  This would help with stripped static functions.

rdar://38761029

llvm-svn: 328274

6 years ago[sanitizer] zx_vmo_write on Fuchsia takes only 4 arguments now
Petr Hosek [Thu, 22 Mar 2018 23:58:37 +0000 (23:58 +0000)]
[sanitizer] zx_vmo_write on Fuchsia takes only 4 arguments now

The system call now fails when it cannot write the requested size.
Update the sanitizer runtime Fuchsia implementation accordingly.

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

llvm-svn: 328273

6 years agoState that CFG is preserved in 'Falkor HW Prefetch Fix Late Phase'.
Michael Zolotukhin [Thu, 22 Mar 2018 23:44:40 +0000 (23:44 +0000)]
State that CFG is preserved in 'Falkor HW Prefetch Fix Late Phase'.

That removes some redundant recomputations from the passes pipeline.

llvm-svn: 328272

6 years ago[Support/Parallel] Use lock_guard which has less overhead than unique_lock.
Fangrui Song [Thu, 22 Mar 2018 23:40:02 +0000 (23:40 +0000)]
[Support/Parallel] Use lock_guard which has less overhead than unique_lock.

Summary: unique_lock has the overhead of tracking ownership status and the owner.

Reviewers: grimar, zturner

Subscribers: llvm-commits

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

llvm-svn: 328271

6 years ago[clang-doc] Reland "[clang-doc] Setup clang-doc frontend framework"
Julie Hockett [Thu, 22 Mar 2018 23:34:46 +0000 (23:34 +0000)]
[clang-doc] Reland "[clang-doc] Setup clang-doc frontend framework"

Fixed windows release build tests.

llvm-svn: 328270

6 years agoAdd temporary printouts to test to help debug failures.
Eric Fiselier [Thu, 22 Mar 2018 23:14:20 +0000 (23:14 +0000)]
Add temporary printouts to test to help debug failures.

Some debian libc++ bots started having failures in the locale
tests due to what I assume is a change in the locale data for fr_FR
in glibc.

This change prints the actual value from the test to help debugging.
It should be reverted once the bots cycle.

llvm-svn: 328268

6 years agoReapply "[test] Add tests for llc passes pipelines." with a fix for bots with expensi...
Michael Zolotukhin [Thu, 22 Mar 2018 23:02:48 +0000 (23:02 +0000)]
Reapply "[test] Add tests for llc passes pipelines." with a fix for bots with expensive checks on.

llvm-svn: 328267

6 years agoSet dso_local on __ImageBase.
Rafael Espindola [Thu, 22 Mar 2018 23:02:19 +0000 (23:02 +0000)]
Set dso_local on __ImageBase.

llvm-svn: 328266

6 years agoAvoid Clang error about throwing _LIBCPP_ASSERT in noexcept function.
Eric Fiselier [Thu, 22 Mar 2018 23:01:08 +0000 (23:01 +0000)]
Avoid Clang error about throwing _LIBCPP_ASSERT in noexcept function.

This fixes a couple of tests which produced a warning that a 'throw'
occurred in a noexcept function (by way of _LIBCPP_ASSERT). It does
so by hiding the 'throw' across an opaque function boundary.

This fix isn't ideal, since we still have _LIBCPP_ASSERT's in functions
marked noexcept -- and this problem should be addressed in the future.
However, throwing _LIBCPP_ASSERT is really only meant to allow testing
of the assertions, and is not yet ready for general use.

llvm-svn: 328265

6 years ago[libcxx] [test] Strip trailing whitespace. NFC.
Stephan T. Lavavej [Thu, 22 Mar 2018 22:59:02 +0000 (22:59 +0000)]
[libcxx] [test] Strip trailing whitespace. NFC.

llvm-svn: 328264

6 years agoAdd a test.
Rafael Espindola [Thu, 22 Mar 2018 22:57:48 +0000 (22:57 +0000)]
Add a test.

This would have found the regression in r328238.

llvm-svn: 328263

6 years agoMove SampleProfile.h into IPO along with the rest of the IPO pass headers
David Blaikie [Thu, 22 Mar 2018 22:42:44 +0000 (22:42 +0000)]
Move SampleProfile.h into IPO along with the rest of the IPO pass headers

llvm-svn: 328262

6 years agoWorkaround GCC bug PR78489 - SFINAE order is not respected.
Eric Fiselier [Thu, 22 Mar 2018 22:32:55 +0000 (22:32 +0000)]
Workaround GCC bug PR78489 - SFINAE order is not respected.

This patch works around variant test failures which are new to
GCC 8. GCC 8 either doesn't perform SFINAE in lexical order, or
it doesn't halt after encountering the first failure. This
causes hard error to occur instead of substitution failure.

See gcc.gnu.org/PR78489

llvm-svn: 328261

6 years ago[X86] Correct the VROUND regular expressions in Znver1 scheduler model to account...
Craig Topper [Thu, 22 Mar 2018 22:17:11 +0000 (22:17 +0000)]
[X86] Correct the VROUND regular expressions in Znver1 scheduler model to account for r328254

llvm-svn: 328260

6 years agoFinish moving the IPSCCP pass from Scalar to IPO - moving the registration
David Blaikie [Thu, 22 Mar 2018 22:07:53 +0000 (22:07 +0000)]
Finish moving the IPSCCP pass from Scalar to IPO - moving the registration

llvm-svn: 328259

6 years ago[analyzer] Enable temporary object destructor inlining by default.
Artem Dergachev [Thu, 22 Mar 2018 22:05:53 +0000 (22:05 +0000)]
[analyzer] Enable temporary object destructor inlining by default.

When a temporary is constructed with a proper construction context, it should
be safe to inline the destructor. We have added suppressions for some of the
common false positives caused by such inlining, so there should be - and from my
observations there indeed is - more benefit than harm from enabling destructor
inlining.

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

llvm-svn: 328258

6 years agoRevert r325687 (workaround for PR36032).
Evgeny Stupachenko [Thu, 22 Mar 2018 22:04:39 +0000 (22:04 +0000)]
Revert r325687 (workaround for PR36032).

Summary:
Revert r325687 workaround for PR36032 since
 a fix was committed in r326154.

Reviewers: sbaranga

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

From: Evgeny Stupachenko <evstupac@gmail.com>
                         <evgeny.v.stupachenko@intel.com>
llvm-svn: 328257

6 years agoAdd test for demangling GNU ABI tags.
Rafael Espindola [Thu, 22 Mar 2018 22:04:32 +0000 (22:04 +0000)]
Add test for demangling GNU ABI tags.

Patch by Christopher James Halse Rogers!

llvm-svn: 328256

6 years ago[CFG] [analyzer] Add C++17-specific ctor-initializer construction contexts.
Artem Dergachev [Thu, 22 Mar 2018 22:02:38 +0000 (22:02 +0000)]
[CFG] [analyzer] Add C++17-specific ctor-initializer construction contexts.

CXXCtorInitializer-based constructors are also affected by the C++17 mandatory
copy elision, like variable constructors and return value constructors.
Extend r328248 to support those.

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

llvm-svn: 328255

6 years ago[X86] Rename VROUNDYPS* and VROUNDYPD* instructions to VROUNDPSY* and VROUNDPDY*...
Craig Topper [Thu, 22 Mar 2018 21:55:20 +0000 (21:55 +0000)]
[X86] Rename VROUNDYPS* and VROUNDYPD* instructions to VROUNDPSY* and VROUNDPDY*. Fix itinerary mistake on all memory forms of VROUNDPD

This makes the Y position consistent with other instructions.

This should have been NFC, but while refactoring the multiclass I noticed that VROUNDPD memory forms were using the register itinerary.

llvm-svn: 328254

6 years ago[analyzer] Remove an assertion that doesn't hold in C++17.
Artem Dergachev [Thu, 22 Mar 2018 21:54:48 +0000 (21:54 +0000)]
[analyzer] Remove an assertion that doesn't hold in C++17.

Function return values can be constructed directly in variables or passed
directly into return statements, without even an elidable copy in between.
This is how the C++17 mandatory copy elision AST behaves. The behavior we'll
have in such cases is the "old" behavior that we've had before we've
implemented destructor inlining and proper lifetime extension support.

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

llvm-svn: 328253

6 years ago[DAGCombiner] Fold (zext (and/or/xor (shl/shr (load x), cst), cst))
Guozhi Wei [Thu, 22 Mar 2018 21:47:25 +0000 (21:47 +0000)]
[DAGCombiner] Fold (zext (and/or/xor (shl/shr (load x), cst), cst))

In our real world application, we found the following optimization is missed in DAGCombiner

(zext (and/or/xor (shl/shr (load x), cst), cst)) -> (and/or/xor (shl/shr (zextload x), (zext cst)), (zext cst))

If the user of original zext is an add, it may enable further lea optimization on x86.

This patch add a new function CombineZExtLogicopShiftLoad to do this optimization.

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

llvm-svn: 328252

6 years agoFix layering between SCCP and IPO SCCP
David Blaikie [Thu, 22 Mar 2018 21:41:29 +0000 (21:41 +0000)]
Fix layering between SCCP and IPO SCCP

Transforms/Scalar/SCCP.cpp implemented both the Scalar and IPO SCCP, but
this meant Transforms/Scalar including Transfroms/IPO headers, creating
a circular dependency. (IPO depends on Scalar already) - so move the IPO
SCCP shims out into IPO and the basic library implementation accessible
from Scalar/SCCP.h to be used from the IPO/SCCP.cpp implementation.

llvm-svn: 328250

6 years ago[CFG] [analyzer] NFC: Move construction context allocation into a helper method.
Artem Dergachev [Thu, 22 Mar 2018 21:40:24 +0000 (21:40 +0000)]
[CFG] [analyzer] NFC: Move construction context allocation into a helper method.

Improve readability of ConstructionContext::createFromLayers().

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

llvm-svn: 328249

6 years ago[CFG] [analyzer] Add C++17-specific variable and return construction contexts.
Artem Dergachev [Thu, 22 Mar 2018 21:37:39 +0000 (21:37 +0000)]
[CFG] [analyzer] Add C++17-specific variable and return construction contexts.

In C++17 copy elision is mandatory for variable and return value constructors
(as long as it doesn't involve type conversion) which results in AST that does
not contain elidable constructors in their usual places. In order to provide
construction contexts in this scenario we need to cover more AST patterns.

This patch makes the CFG prepared for these scenarios by:

- Fork VariableConstructionContext and ReturnedValueConstructionContext into
  two different sub-classes (each) one of which indicates the C++17 case and
  contains a reference to an extra CXXBindTemporaryExpr.
- Allow CFGCXXRecordTypedCall element to accept VariableConstructionContext and
  ReturnedValueConstructionContext as its context.

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

llvm-svn: 328248

6 years ago[analyzer] Make symbol_iterator iterate over SVal's symbolic base.
Artem Dergachev [Thu, 22 Mar 2018 21:30:58 +0000 (21:30 +0000)]
[analyzer] Make symbol_iterator iterate over SVal's symbolic base.

If a memory region (or an SVal that represents a pointer to that memory region)
is a (direct or indirect, not necessarily proper) sub-region of a SymbolicRegion
then it is said to have a symbolic base.

For now SVal::symbol_iterator explores the symbol within a symbolic region
only when the SVal represents a pointer to the symbolic region itself,
not to any of its sub-regions.

This behavior is not indended by any user of symbol_iterator; all users who
cared about such behavior were expecting the iterator to descend into the
symbolic base of an arbitrary region, find the parent symbol of the symbolic
base region, and iterate over that symbol. Lack of such behavior resulted in
bugs demonstarted by the test cases.

Hence the decision to change the API to behave more intuitively.

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

llvm-svn: 328247

6 years ago[MIR] Making MIR Printing, opt -dot-cfg, and -debug printing faster
Roman Tereshin [Thu, 22 Mar 2018 21:29:07 +0000 (21:29 +0000)]
[MIR] Making MIR Printing, opt -dot-cfg, and -debug printing faster

Value::printAsOperand has been scanning the entire module just to
print a single value as an operand, regardless being asked to print a
type or not at all, and regardless really needing to scan the module
to print a type.

It made some of the users of the method exceptionally slow on large
IR-modules (or large MIR-files with large IR-modules embedded).

This patch defers scanning a module looking for struct types, mostly
numbered struct types, as much as possible, speeding up those users
w/o changing any APIs at all.

See speedup examples below:

Release Build:

# 83 seconds -> 5.5 seconds
time ./bin/llc -start-before=irtranslator -stop-after=irtranslator \
  -global-isel -global-isel-abort=2 -simplify-mir sqlite3.O0.ll -o \
  sqlite3.O0.ll.regbankselected.mir

# 133 seconds -> 6.2 seconds
time ./bin/opt sqlite3.O0.ll -dot-cfg -disable-output

Release + Asserts Build:

# 95 seconds -> 5.5 seconds
time ./bin/llc -start-before=irtranslator -stop-after=irtranslator \
  -global-isel -global-isel-abort=2 -simplify-mir sqlite3.O0.ll -o \
  sqlite3.O0.ll.regbankselected.mir

# 146 seconds -> 6.2 seconds
time ./bin/opt sqlite3.O0.ll -dot-cfg -disable-output

# 1096 seconds -> 553 seconds
time ./bin/llc -debug-only=isel -fast-isel=false -stop-after=isel \
  sqlite3.O0.ll -o /dev/null 2> err

where sqlite3.O0.ll is non-optimized IR produced from
sqlite-amalgamation (http://sqlite.org/download.html), which is entire
SQLite3 implementation in a single C-file.

Benchmarked on 4-cores / 8 threads PCI-E SSD iMac running macOS

Reviewers: dexonsmith, bkramer, void, chandlerc, aditya_nandakumar, dsanders, qcolombet,

Reviewed By: bogner

Subscribers: thegameg, llvm-commits

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

llvm-svn: 328246

6 years agoUse DoNotOptimize to prevent new/delete elision.
Eric Fiselier [Thu, 22 Mar 2018 21:28:09 +0000 (21:28 +0000)]
Use DoNotOptimize to prevent new/delete elision.

The new/delete tests, in particular those which test replacement
functions, often fail when the optimizer is enabled because the
calls to new/delete may be optimized away, regardless of their side-effects.

This patch converts the tests to use DoNotOptimize in order to prevent
the elision.

llvm-svn: 328245

6 years agoRevert "Revert "[InstrProf] Support for external functions in text format.""
Mircea Trofin [Thu, 22 Mar 2018 21:26:52 +0000 (21:26 +0000)]
Revert "Revert "[InstrProf] Support for external functions in text format.""

Summary:
This reverts commit 364eb09576a7667bc6d3ff80c52a83014ccac976 and separates out
the portion that was fixing binary reader error propagation - turns out, there
are production cases where that causes a regression.

Will re-introduce the error propagation fix separately.

The fix to the text reader error propagation is still "in".

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: llvm-commits

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

llvm-svn: 328244

6 years agoFix test failure on Windows caused by different underlying enumeration type rules
Eric Fiselier [Thu, 22 Mar 2018 21:17:07 +0000 (21:17 +0000)]
Fix test failure on Windows caused by different underlying enumeration type rules

llvm-svn: 328243

6 years agoRevert "Set dso_local on vtables."
Rafael Espindola [Thu, 22 Mar 2018 21:14:16 +0000 (21:14 +0000)]
Revert "Set dso_local on vtables."

This reverts commit r328238.

Looks like it broke some buildbots.

llvm-svn: 328242

6 years ago[X86][SkylakeClient] Fix a bunch of instructions that were incorrectly assigned Port0...
Craig Topper [Thu, 22 Mar 2018 21:10:07 +0000 (21:10 +0000)]
[X86][SkylakeClient] Fix a bunch of instructions that were incorrectly assigned Port015 instead of Port01.

The VEC ADD and VEC MUL units aren't present on port 5 on SkylakeClient.

llvm-svn: 328241

6 years ago[MachineOutliner][NFC] Refactoring + comments in runOnModule
Jessica Paquette [Thu, 22 Mar 2018 21:07:09 +0000 (21:07 +0000)]
[MachineOutliner][NFC] Refactoring + comments in runOnModule

Split up some of the if/else branches in runOnModule. Elaborate on some
comments. Replace a call to getOrCreateMachineFunction with getMachineFunction.

This makes it clearer what's happening in runOnModule, and ensures that the
outliner doesn't create any MachineFunctions which will never be used by the
outliner (or anything else, really).

llvm-svn: 328240

6 years agoMore OpenBSD fixes
Vitaly Buka [Thu, 22 Mar 2018 20:42:28 +0000 (20:42 +0000)]
More OpenBSD fixes

Summary:
- Use internal_syscall_ptr in internal_readlink
- use sigcontext on OpenBSD

Patch by David CARLIER

Reviewers: krytarowski, vitalybuka

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

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

llvm-svn: 328239

6 years agoSet dso_local on vtables.
Rafael Espindola [Thu, 22 Mar 2018 20:33:01 +0000 (20:33 +0000)]
Set dso_local on vtables.

llvm-svn: 328238

6 years ago[CodeGen] Add a new pass for PostRA sink
Jun Bum Lim [Thu, 22 Mar 2018 20:06:47 +0000 (20:06 +0000)]
[CodeGen] Add a new pass for PostRA sink

Summary:
This pass sinks COPY instructions into a successor block, if the COPY is not
used in the current block and the COPY is live-in to a single successor
(i.e., doesn't require the COPY to be duplicated).  This avoids executing the
the copy on paths where their results aren't needed.  This also exposes
additional opportunites for dead copy elimination and shrink wrapping.

These copies were either not handled by or are inserted after the MachineSink
pass. As an example of the former case, the MachineSink pass cannot sink
COPY instructions with allocatable source registers; for AArch64 these type
of copy instructions are frequently used to move function parameters (PhyReg)
into virtual registers in the entry block..

For the machine IR below, this pass will sink %w19 in the entry into its
successor (%bb.1) because %w19 is only live-in in %bb.1.

```
   %bb.0:
      %wzr = SUBSWri %w1, 1
      %w19 = COPY %w0
      Bcc 11, %bb.2
    %bb.1:
      Live Ins: %w19
      BL @fun
      %w0 = ADDWrr %w0, %w19
      RET %w0
    %bb.2:
      %w0 = COPY %wzr
      RET %w0
```
As we sink %w19 (CSR in AArch64) into %bb.1, the shrink-wrapping pass will be
able to see %bb.0 as a candidate.

With this change I observed 12% more shrink-wrapping candidate and 13% more dead copies deleted  in spec2000/2006/2017 on AArch64.

Reviewers: qcolombet, MatzeB, thegameg, mcrosier, gberry, hfinkel, john.brawn, twoh, RKSimon, sebpop, kparzysz

Reviewed By: sebpop

Subscribers: evandro, sebpop, sfertile, aemerson, mgorny, javed.absar, kristof.beyls, llvm-commits

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

llvm-svn: 328237

6 years agoDocument optforfuzzing attribute created in r328214.
Matt Morehouse [Thu, 22 Mar 2018 19:50:10 +0000 (19:50 +0000)]
Document optforfuzzing attribute created in r328214.

llvm-svn: 328236

6 years ago[DWARF] Replace assert with diagnostic. PR36868.
Paul Robinson [Thu, 22 Mar 2018 19:37:56 +0000 (19:37 +0000)]
[DWARF] Replace assert with diagnostic. PR36868.

llvm-svn: 328235

6 years agoMove the initialization of the Meta Renamer pass over to IPO along with the rest...
David Blaikie [Thu, 22 Mar 2018 19:36:54 +0000 (19:36 +0000)]
Move the initialization of the Meta Renamer pass over to IPO along with the rest of it that was moved in r328209

llvm-svn: 328234

6 years ago[DAG, X86] Fix ISel-time node insertion ids
Nirav Dave [Thu, 22 Mar 2018 19:32:07 +0000 (19:32 +0000)]
[DAG, X86] Fix ISel-time node insertion ids

As in SystemZ backend, correctly propagate node ids when inserting new
unselected nodes into the DAG during instruction Seleciton for X86
target.

Fixes PR36865.

Reviewers: jyknight, craig.topper

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 328233

6 years ago[SymbolFilePDB] Use section contributions as another way to determine the compiland
Aaron Smith [Thu, 22 Mar 2018 19:26:33 +0000 (19:26 +0000)]
[SymbolFilePDB] Use section contributions as another way to determine the compiland

Some PDB Symbols don't have line information. Use the section contributions to determine their compiland.
This is useful to determine the parent compiland for PDBSymbolTypeData, i.e. variables.

llvm-svn: 328232