OSDN Git Service

android-x86/external-llvm.git
5 years agogn build: Merge r358722
Nico Weber [Fri, 19 Apr 2019 13:18:41 +0000 (13:18 +0000)]
gn build: Merge r358722

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358755 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r358691
Nico Weber [Fri, 19 Apr 2019 13:16:26 +0000 (13:16 +0000)]
gn build: Merge r358691

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358754 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LTO] Add plumbing to save stats during LTO on Darwin.
Florian Hahn [Fri, 19 Apr 2019 12:36:41 +0000 (12:36 +0000)]
[LTO] Add plumbing to save stats during LTO on Darwin.

Gold and ld on Linux already support saving stats, but the
infrastructure is missing on Darwin. Unfortunately it seems like the
configuration from lib/LTO/LTO.cpp is not used.

This patch adds a new LTOStatsFile option and adds plumbing in Clang to
use it on Darwin, similar to the way remarks are handled.

Currnetly the handling of LTO flags seems quite spread out, with a bunch
of duplication. But I am not sure if there is an easy way to improve
that?

Reviewers: anemet, tejohnson, thegameg, steven_wu

Reviewed By: steven_wu

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358753 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoChange \r\n -> \n for llvm-symbolizer/help.test after rL358749
Fangrui Song [Fri, 19 Apr 2019 12:28:36 +0000 (12:28 +0000)]
Change \r\n -> \n for llvm-symbolizer/help.test after rL358749

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358751 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-symbolizer] Add llvm-addr2line
Igor Kudrin [Fri, 19 Apr 2019 10:17:52 +0000 (10:17 +0000)]
[llvm-symbolizer] Add llvm-addr2line

This adds an alias for llvm-symbolizer with different defaults so that
it can be used as a drop-in replacement for GNU's addr2line.

If a substring "addr2line" is found in the tool's name:
  * it defaults "-i", "-f" and "-C" to OFF;
  * it uses "--output-style=GNU" by default.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358749 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-symbolizer] Unhide and document the "-output-style" option
Igor Kudrin [Fri, 19 Apr 2019 10:14:18 +0000 (10:14 +0000)]
[llvm-symbolizer] Unhide and document the "-output-style" option

With the latest changes, the option gets useful for users of
llvm-symbolizer, not only for the upcoming llvm-addr2line.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358748 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-symbolizer] Make the output with -output-style=GNU closer to addr2line's
Igor Kudrin [Fri, 19 Apr 2019 10:12:56 +0000 (10:12 +0000)]
[llvm-symbolizer] Make the output with -output-style=GNU closer to addr2line's

This patch addresses two differences in the output of llvm-symbolizer
and GNU's addr2line:

* llvm-symbolizer prints an empty line after the report for an address.

* With "-f -i=0", llvm-symbolizer replaces the name of an inlined
  function with the name from the symbol table, i. e., the top caller
  function in the inlining chain. addr2line preserves the name of the
  inlined function.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358747 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Regenerate extractelt->truncate test.
Simon Pilgrim [Fri, 19 Apr 2019 09:49:04 +0000 (09:49 +0000)]
[AMDGPU] Regenerate extractelt->truncate test.

Prep work for D60462

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358746 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGen] Add "const" to MachineInstr::mayAlias
Bjorn Pettersson [Fri, 19 Apr 2019 09:08:38 +0000 (09:08 +0000)]
[CodeGen] Add "const" to MachineInstr::mayAlias

Summary:
The basic idea here is to make it possible to use
MachineInstr::mayAlias also when the MachineInstr
is const (or the "Other" MachineInstr is const).

The addition of const in MachineInstr::mayAlias
then rippled down to the need for adding const
in several other places, such as
TargetTransformInfo::getMemOperandWithOffset.

Reviewers: hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, MatzeB, arsenm, jvesely, nhaehnle, hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358744 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PATCH] [MachineScheduler] Check pending instructions when an instruction is scheduled
James Molloy [Fri, 19 Apr 2019 09:00:55 +0000 (09:00 +0000)]
[PATCH] [MachineScheduler] Check pending instructions when an instruction is scheduled

Pending instructions that may have been blocked from being available by the HazardRecognizer may no longer may not be blocked any more when an instruction is scheduled; pending instructions should be re-checked in this case.

This is primarily aimed at VLIW targets with large parallelism and esoteric constraints.

No testcase as no in-tree targets have this behavior.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358743 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MergeFunc] Delete unused FunctionNode::release()
Fangrui Song [Fri, 19 Apr 2019 08:03:20 +0000 (08:03 +0000)]
[MergeFunc] Delete unused FunctionNode::release()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358742 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MergeFunc] removeUsers: call remove() only on direct users
Fangrui Song [Fri, 19 Apr 2019 07:57:51 +0000 (07:57 +0000)]
[MergeFunc] removeUsers: call remove() only on direct users

removeUsers uses a work list to collect indirect users and call remove()
on those functions. However it has a bug (`if (!Visited.insert(UU).second)`).

Actually, we don't have to collect indirect users.
After the merge of F and G, G's callers will be considered (added to
Deferred). If G's callers can be merged, G's callers' callers will be
considered.

Update the test unnamed-addr-reprocessing.ll to make it clear we can
still merge indirect callers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358741 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Ignore non-SUnits edges
Piotr Sobczak [Fri, 19 Apr 2019 06:19:14 +0000 (06:19 +0000)]
[AMDGPU] Ignore non-SUnits edges

Summary:
Ignore edges to non-SUnits (e.g. ExitSU) when checking
for low latency instructions.

When calling the function isLowLatencyInstruction(),
an ExitSU could be on the list of successors, not necessarily
a regular SU. In other places in the code there is a check
"Succ->NodeNum >= DAGSize" to prevent further processing of
ExitSU as "Succ->getInstr()" is NULL in such a case.
Also, 8 out of 9 cases of "SUnit *Succ = SuccDep.getSUnit())"
has the guard, so it is clearly an omission here.

Change-Id: Ica86f0327c7b2e6bcb56958e804ea6c71084663b

Reviewers: nhaehnle

Reviewed By: nhaehnle

Subscribers: MatzeB, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358740 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CallSite removal] Move the legacy PM, call graph, and some inliner
Chandler Carruth [Fri, 19 Apr 2019 05:59:42 +0000 (05:59 +0000)]
[CallSite removal]  Move the legacy PM, call graph, and some inliner
code to `CallBase`.

This patch focuses on the legacy PM, call graph, and some of inliner and legacy
passes interacting with those APIs from `CallSite` to the new `CallBase` class.
No interesting changes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358739 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MergeFunc] Use less_first() as the comparator of Schwartzian transform
Fangrui Song [Fri, 19 Apr 2019 05:49:29 +0000 (05:49 +0000)]
[MergeFunc] Use less_first() as the comparator of Schwartzian transform

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358738 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Turn (and (shl X, C1), C2) into (shl (and X, (C1 >> C2), C2) if the AND could...
Craig Topper [Fri, 19 Apr 2019 05:48:13 +0000 (05:48 +0000)]
[X86] Turn (and (shl X, C1), C2) into (shl (and X, (C1 >> C2), C2) if the AND could match a movzx.

Could get further improvements by recognizing (i64 and (anyext (i32 shl))).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358737 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add test cases for turning (and (shl X, C1), C2) into (shl (and X, (C1 >> C2...
Craig Topper [Fri, 19 Apr 2019 05:48:09 +0000 (05:48 +0000)]
[X86] Add test cases for turning (and (shl X, C1), C2) into (shl (and X, (C1 >> C2), C2) when the AND could match to a movzx.

We already reorder when C1 >> C2 would allow a smaller immediate encoding.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358736 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Make sure we copy the HandleSDNode back to N before executing the default code...
Craig Topper [Fri, 19 Apr 2019 04:52:21 +0000 (04:52 +0000)]
[X86] Make sure we copy the HandleSDNode back to N before executing the default code after the switch in matchAddressRecursively

Summary:
There are two places where we create a HandleSDNode in address matching in order to handle the case where N is changed by CSE. But if we end up not matching, we fall back to code at the bottom of the switch that really would like N to point to something that wasn't CSEd away. So we should make sure we copy the handle back to N on any paths that can reach that code.

This appears to be the true reason we needed to check DELETED_NODE in the negation matching. In pr32329.ll we had two subtracts back to back. We recursed through the first subtract, and onto the second subtract. The second subtract called matchAddressRecursively on its LHS which caused that subtract to CSE. We ultimately failed the match and ended up in the default code. But N was pointing at the old node that had been deleted, but the default code didn't know that and took it as the base register. Then we unwound back to the first subtract and tried to access this bogus base reg requiring the check for deleted node. With this patch we now use the CSE result as the base reg instead.

matchAdd has been broken since sometime in 2015 when it was pulled out of the switch into a helper function. The assignment to N at the end was still there, but N was passed by value and not by reference so the update didn't go anywhere.

Reviewers: niravd, spatel, RKSimon, bkramer

Reviewed By: niravd

Subscribers: llvm-commits, hiraditya

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358735 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DWARF] Use hasFileAtIndex to properly verify DWARF 5 after rL358732
Fangrui Song [Fri, 19 Apr 2019 03:34:28 +0000 (03:34 +0000)]
[DWARF] Use hasFileAtIndex to properly verify DWARF 5 after rL358732

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358734 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm] Prevent duplicate files in debug line header in dwarf 5: another attempt
Ali Tamur [Fri, 19 Apr 2019 02:26:56 +0000 (02:26 +0000)]
[llvm] Prevent duplicate files in debug line header in dwarf 5: another attempt

Another attempt to land the changes in debug line header to prevent duplicate
files in Dwarf 5. I rolled back my previous commit because of a mistake in
generating the object file in a test. Meanwhile, I addressed some offline
comments and changed the implementation; the largest difference is that
MCDwarfLineTableHeader does not keep DwarfVersion but gets it as a parameter. I
also merged the patch to fix two lld tests that will strt to fail into this
patch.

Original Commit:

https://reviews.llvm.org/D59515

Original Message:
Motivation: In previous dwarf versions, file name indexes started from 1, and
the primary source file was not explicit. Dwarf 5 standard (6.2.4) prescribes
the primary source file to be explicitly given an entry with an index number 0.

The current implementation honors the specification by just duplicating the
main source file, once with index number 0, and later maybe with another
index number. While this is compliant with the letter of the standard, the
duplication causes problems for consumers of this information such as lldb.
(Some files are duplicated, where only some of them have a line table although
all refer to the same file)

With this change, dwarf 5 debug line section files always start from 0, and
the zeroth entry is not duplicated whenever possible. This requires different
handling of dwarf 4 and dwarf 5 during generation (e.g. when a function returns
an index zero for a file name, it signals an error in dwarf 4, but not in dwarf
5) However, I think the minor complication is worth it, because it enables all
consumers (lldb, gdb, dwarfdump, objdump, and so on) to treat all files in the
file name list homogenously.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358732 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[APInt] Optimize umul_ov
Fangrui Song [Fri, 19 Apr 2019 02:06:06 +0000 (02:06 +0000)]
[APInt] Optimize umul_ov

Change two costly udiv() calls to lshr(1)*RHS + left-shift + plus

On one 64-bit umul_ov benchmark, I measured an obvious improvement: 12.8129s -> 3.6257s

Note, there may be some value to special case 64-bit (the most common
case) with __builtin_umulll_overflow().

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358730 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMergeFunc: preserve COMDAT information when creating a thunk
Saleem Abdulrasool [Fri, 19 Apr 2019 01:48:36 +0000 (01:48 +0000)]
MergeFunc: preserve COMDAT information when creating a thunk

We would previously drop the COMDAT on the thunk we generated when replacing a
function body with the forwarding thunk. This would result in a function that
may have been multiply emitted and multiply merged to be emitted with the same
name without the COMDAT. This is a hard error with PE/COFF where the COMDAT is
used for the deduplication of Value Witness functions for Swift.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358728 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LoopUnroll] Move list of params into a struct [NFCI].
Alina Sbirlea [Thu, 18 Apr 2019 23:43:49 +0000 (23:43 +0000)]
[LoopUnroll] Move list of params into a struct [NFCI].

Summary: Cleanup suggested in review of r358304.

Reviewers: sanjoy, efriedma

Subscribers: jlebar, zzheng, dmgreen, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358723 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64] add tests for mul-by-element; NFC
Sanjay Patel [Thu, 18 Apr 2019 21:48:46 +0000 (21:48 +0000)]
[AArch64] add tests for mul-by-element; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358718 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoImplement sys::fs::copy_file using the macOS copyfile(3) API
Adrian Prantl [Thu, 18 Apr 2019 21:22:50 +0000 (21:22 +0000)]
Implement sys::fs::copy_file using the macOS copyfile(3) API
to support APFS clones.

This patch adds a Darwin-specific implementation of
llvm::sys::fs::copy_file() that uses the macOS copyfile(3) API to
support APFS copy-on-write clones, which should be faster and much
more space efficient.

https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/APFS_Guide/ToolsandAPIs/ToolsandAPIs.html

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

This reapplies 358628 with an additional bugfix handling the case
where the destination file already exists. (Caught by the clang testsuite).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358716 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel][AArch64] Legalize/select G_(S/Z/ANY)_EXT for v8s8s
Jessica Paquette [Thu, 18 Apr 2019 21:15:48 +0000 (21:15 +0000)]
[GlobalISel][AArch64] Legalize/select G_(S/Z/ANY)_EXT for v8s8s

This adds legalization for G_SEXT, G_ZEXT, and G_ANYEXT for v8s8s.

We were falling back on G_ZEXT in arm64-vabs.ll before, preventing us from
selecting the @llvm.aarch64.neon.sabd.v8i8 intrinsic.

This adds legalizer support for those 3, which gives us selection via the
importer. Update the relevant tests (legalize-ext.mir, select-int-ext.mir) and
add a GISel line to arm64-vabs.ll.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358715 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel][AArch64] Legalize v8s8 loads
Jessica Paquette [Thu, 18 Apr 2019 21:13:58 +0000 (21:13 +0000)]
[GlobalISel][AArch64] Legalize v8s8 loads

Add legalizer support for loads of v8s8 and update legalize-load-store.mir.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358714 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-undname: Fix two more asserts-on-invalid, found by oss-fuzz
Nico Weber [Thu, 18 Apr 2019 19:52:32 +0000 (19:52 +0000)]
llvm-undname: Fix two more asserts-on-invalid, found by oss-fuzz

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358708 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-undname: Fix two asserts-on-invalid
Nico Weber [Thu, 18 Apr 2019 19:30:21 +0000 (19:30 +0000)]
llvm-undname: Fix two asserts-on-invalid

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358707 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GuardWidening] Wire up a NPM version of the LoopGuardWidening pass
Philip Reames [Thu, 18 Apr 2019 19:17:14 +0000 (19:17 +0000)]
[GuardWidening] Wire up a NPM version of the LoopGuardWidening pass

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358704 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] FMF propagation for GlobalIsel
Michael Berg [Thu, 18 Apr 2019 18:48:57 +0000 (18:48 +0000)]
[NFC] FMF propagation for GlobalIsel

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358702 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[BlockExtractor] Extend the file format to support the grouping of basic blocks
Quentin Colombet [Thu, 18 Apr 2019 18:28:30 +0000 (18:28 +0000)]
[BlockExtractor] Extend the file format to support the grouping of basic blocks

Prior to this patch, each basic block listed in the extrack-blocks-file
would be extracted to a different function.

This patch adds the support for comma separated list of basic blocks
to form group.

When the region formed by a group is not extractable, e.g., not single
entry, all the blocks of that group are left untouched.

Let us see this new format in action (comments are not part of the
file format):
;; funcName bbName[,bbName...]
   foo      bb1        ;; Extract bb1 in its own function
   foo      bb2,bb3    ;; Extract bb2,bb3 in their own function
   bar      bb1,bb4    ;; Extract bb1,bb4 in their own function
   bar      bb2        ;; Extract bb2 in its own function

Assuming all regions are extractable, this will create one function and
thus one call per region.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358701 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC] Add some PPC vec cost tests to prep for D60160 NFC
Roland Froese [Thu, 18 Apr 2019 18:12:09 +0000 (18:12 +0000)]
[PowerPC] Add some PPC vec cost tests to prep for D60160 NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358699 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] combineVectorTruncationWithPACKUS - remove split/concatenation of mask
Simon Pilgrim [Thu, 18 Apr 2019 17:23:09 +0000 (17:23 +0000)]
[X86] combineVectorTruncationWithPACKUS - remove split/concatenation of mask

combineVectorTruncationWithPACKUS is currently splitting the upper bit bit masking into 128-bit subregs and then concatenating them back together.

This was originally done to avoid regressions that caused existing subregs to be concatenated to the larger type just for the AND masking before being extracted again. This was fixed by @spatel (notably rL303997 and rL347356).

This also lets SimplifyDemandedBits do some further improvements before it hits the recursive depth limit.

My only annoyance with this is that we were broadcasting some xmm masks but we seem to have lost them by moving to ymm - but that's a known issue as the logic in lowerBuildVectorAsBroadcast isn't great.

Differential Revision: https://reviews.llvm.org/D60375#inline-539623

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358692 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LoopPred] Fix a blatantly obvious bug in r358684
Philip Reames [Thu, 18 Apr 2019 17:01:19 +0000 (17:01 +0000)]
[LoopPred] Fix a blatantly obvious bug in r358684

The bug is that I didn't check whether the operand of the invariant_loads were themselves invariant.  I don't know how this got missed in the patch and review.  I even had an unreduced test case locally, and I remember handling this case, but I must have lost it in one of the rebases.  Oops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358688 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] add tests for improved insertelement to index 0 (PR41512); NFC
Sanjay Patel [Thu, 18 Apr 2019 16:58:50 +0000 (16:58 +0000)]
[x86] add tests for improved insertelement to index 0 (PR41512); NFC

Patch proposal in D60852.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358687 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CMake] Allow custom extensions for externalized debug info
Stefan Granitz [Thu, 18 Apr 2019 16:37:07 +0000 (16:37 +0000)]
[CMake] Allow custom extensions for externalized debug info

Summary:
Extra flexibility for emitting debug info to external files (remains Darwin only for now).
LLDB needs this functionality to emit a LLDB.framework.dSYM instead of LLDB.dSYM when building the framework, because the latter could conflict with the driver's lldb.dSYM when emitted in the same directory on case-insensitive file systems.

Reviewers: friss, bogner, beanz

Subscribers: mgorny, aprantl, llvm-commits, #lldb

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358685 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LoopPredication] Allow predication of loop invariant computations (within the loop)
Philip Reames [Thu, 18 Apr 2019 16:33:17 +0000 (16:33 +0000)]
[LoopPredication] Allow predication of loop invariant computations (within the loop)

The purpose of this patch is to eliminate a pass ordering dependence between LoopPredication and LICM. To understand the purpose, consider the following snippet of code inside some loop 'L' with IV 'i'
A = _a.length;
guard (i < A)
a = _a[i]
B = _b.length;
guard (i < B);
b = _b[i];
...
Z = _z.length;
guard (i < Z)
z = _z[i]
accum += a + b + ... + z;

Today, we need LICM to hoist the length loads, LoopPredication to make the guards loop invariant, and TrivialUnswitch to eliminate the loop invariant guard to establish must execute for the next length load. Today, if we can't prove speculation safety, we'd have to iterate these three passes 26 times to reduce this example down to the minimal form.

Using the fact that the array lengths are known to be invariant, we can short circuit this iteration. By forming the loop invariant form of all the guards at once, we remove the need for LoopPredication from the iterative cycle. At the moment, we'd still have to iterate LICM and TrivialUnswitch; we'll leave that part for later.

As a secondary benefit, this allows LoopPred to expose peeling oppurtunities in a much more obvious manner.  See the udiv test changes as an example.  If the udiv was not hoistable (i.e. we couldn't prove speculation safety) this would be an example where peeling becomes obviously profitable whereas it wasn't before.

A couple of subtleties in the implementation:
- SCEV's isSafeToExpand guarantees speculation safety (i.e. let's us expand at a new point).  It is not a precondition for expansion if we know the SCEV corresponds to a Value which dominates the requested expansion point.
- SCEV's isLoopInvariant returns true for expressions which compute the same value across all iterations executed, regardless of where the original Value is located.  (i.e. it can be in the loop)  This implies we have a speculation burden to prove before expanding them outside loops.
- invariant_loads and AA->pointsToConstantMemory are two cases that SCEV currently does not handle, but meets the SCEV definition of invariance.  I plan to sink this part into SCEV once this has baked for a bit.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358684 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SDA] Bug fix: Use IPD outside the loop as divergence bound
Nicolai Haehnle [Thu, 18 Apr 2019 16:17:35 +0000 (16:17 +0000)]
[SDA] Bug fix: Use IPD outside the loop as divergence bound

Summary:
The immediate post dominator of the loop header may be part of the divergent loop.
Since this /was/ the divergence propagation bound the SDA would not detect joins of divergent paths outside the loop.

Reviewers: nhaehnle

Reviewed By: nhaehnle

Subscribers: mmasten, arsenm, jvesely, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358681 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix a bug in SCEV's isSafeToExpand around speculation safety
Philip Reames [Thu, 18 Apr 2019 16:10:21 +0000 (16:10 +0000)]
Fix a bug in SCEV's isSafeToExpand around speculation safety

isSafeToExpand was making a common, but dangerously wrong, mistake in assuming that if any instruction within a basic block executes, that all instructions within that block must execute.  This can be trivially shown to be false by considering the following small example:
bb:
  add x, y  <-- InsertionPoint
  call @throws()
  udiv x, y <-- SCEV* S
  br ...

It's clearly not legal to expand S above the throwing call, but the previous logic would do so since S dominates (but not properlyDominates) the block containing the InsertionPoint.

Since iterating instructions w/in a block is expensive, this change special cases two cases: 1) S is an operand of InsertionPoint, and 2) InsertionPoint is the terminator of it's block.  These two together are enough to keep all current optimizations triggering while fixing the latent correctness issue.

As best I can tell, this is a silent bug in current ToT.  Given that, there's no tests with this change.  It was noticed in an upcoming optimization change (D60093), and was reviewed as part of that.  That change will include the test which caused me to notice the issue.  I'm submitting this seperately so that anyone bisecting a problem gets a clear explanation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358680 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMinidumpYAML: Fix ambiguity between std::make_unique and llvm::make_unique
Benjamin Kramer [Thu, 18 Apr 2019 15:06:03 +0000 (15:06 +0000)]
MinidumpYAML: Fix ambiguity between std::make_unique and llvm::make_unique

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358673 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMinidumpYAML: Add support for ModuleList stream
Pavel Labath [Thu, 18 Apr 2019 14:57:31 +0000 (14:57 +0000)]
MinidumpYAML: Add support for ModuleList stream

Summary:
This patch adds support for yaml (de)serialization of the minidump
ModuleList stream. It's a fairly straight forward-application of the
existing patterns to the ModuleList structures defined in previous
patches.

One thing, which may be interesting to call out explicitly is the
addition of "new" allocation functions to the helper BlobAllocator
class. The reason for this was, that there was an emerging pattern of a
need to allocate space for entities, which do not have a suitable
lifetime for use with the existing allocation functions. A typical
example of that was the "size" of various lists, which is only available
as a temporary returned by the .size() method of some container. For
these cases, one can use the new set of allocation functions, which
will take a temporary object, and store it in an allocator-managed
buffer until it is written to disk.

Reviewers: amccarth, jhenderson, clayborg, zturner

Subscribers: lldb-commits, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358672 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r358607
Nico Weber [Thu, 18 Apr 2019 14:27:38 +0000 (14:27 +0000)]
gn build: Merge r358607

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358670 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r358633
Nico Weber [Thu, 18 Apr 2019 14:26:52 +0000 (14:26 +0000)]
gn build: Merge r358633

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358669 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r358620
Nico Weber [Thu, 18 Apr 2019 14:25:45 +0000 (14:25 +0000)]
gn build: Merge r358620

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358668 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objcopy] Add -B mips
Jordan Rupprecht [Thu, 18 Apr 2019 14:22:37 +0000 (14:22 +0000)]
[llvm-objcopy] Add -B mips

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358667 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[yaml2elf/obj2yaml] - Allow normal parsing/dumping of the .rela.dyn section
George Rimar [Thu, 18 Apr 2019 11:02:07 +0000 (11:02 +0000)]
[yaml2elf/obj2yaml] - Allow normal parsing/dumping of the .rela.dyn section

.rela.dyn is a section that has sh_info normally
set to zero. And Info is an optional field in the description
of the relocation section in YAML.

But currently, yaml2obj would fail to produce the object when
Info is not explicitly listed.

The patch fixes the issue.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358656 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Lower ICMP EQ(AND(X,C),C) -> SRA(SHL(X,LOG2(C)),BW-1) iff C is power-of-2.
Simon Pilgrim [Thu, 18 Apr 2019 09:58:59 +0000 (09:58 +0000)]
[X86][SSE] Lower ICMP EQ(AND(X,C),C) -> SRA(SHL(X,LOG2(C)),BW-1) iff C is power-of-2.

This replaces the MOVMSK combine introduced at D52121/rL342326

(movmsk (setne (and X, (1 << C)), 0)) -> (movmsk (X << C))

with the more general icmp lowering so it can pick up more cases through bitcasts - notably vXi8 cases which use vXi16 shifts+masks, this patch can remove the mask and use pcmpgtb(0,x) for the sra.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358651 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objcopy][llvm-strip] Add switch to allow removing referenced sections
James Henderson [Thu, 18 Apr 2019 09:13:30 +0000 (09:13 +0000)]
[llvm-objcopy][llvm-strip] Add switch to allow removing referenced sections

llvm-objcopy currently emits an error if a section to be removed is
referenced by another section. This is a reasonable thing to do, but is
different to GNU objcopy. We should allow users who know what they are
doing to have a way to produce the invalid ELF. This change adds a new
switch --allow-broken-links to both llvm-strip and llvm-objcopy to do
precisely that. The corresponding sh_link field is then set to 0 instead
of an error being emitted.

I cannot use llvm-readelf/readobj to test the link fields because they
emit an error if any sections, like the .dynsym, cannot be properly
loaded.

Reviewed by: rupprecht, grimar

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358649 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTest commit access [NFC]
Cullen Rhodes [Thu, 18 Apr 2019 08:57:58 +0000 (08:57 +0000)]
Test commit access [NFC]

Remove a trailing space

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358648 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NewPM] Add Option handling for LoopVectorize
Serguei Katkov [Thu, 18 Apr 2019 08:46:11 +0000 (08:46 +0000)]
[NewPM] Add Option handling for LoopVectorize

This patch enables passing options to LoopVectorizePass via the passes pipeline.

Reviewers: chandlerc, fedor.sergeev, leonardchan, philip.pfaffe
Reviewed By: fedor.sergeev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D60681

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358647 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC] Fix wrong ElemSIze when calling isConsecutiveLS()
Kang Zhang [Thu, 18 Apr 2019 07:24:15 +0000 (07:24 +0000)]
[PowerPC] Fix wrong ElemSIze when calling isConsecutiveLS()

Summary:
This issue from the bugzilla: https://bugs.llvm.org/show_bug.cgi?id=41177

When the two operands for BUILD_VECTOR are same, we will get assert error.
llvm::SDValue combineBVOfConsecutiveLoads(llvm::SDNode*, llvm::SelectionDAG&):
Assertion `!(InputsAreConsecutiveLoads && InputsAreReverseConsecutive) &&
"The loads cannot be both consecutive and reverse consecutive."' failed.

This error caused by the wrong ElemSIze when calling isConsecutiveLS(). We
should use `getScalarType().getStoreSize();` to get the ElemSize instread of
 `getScalarSizeInBits() / 8`.

Reviewed By: jsji

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358644 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-profdata] Fix one bad format in llvm-profdata CommandGuide doc. NFC
Rong Xu [Thu, 18 Apr 2019 07:11:05 +0000 (07:11 +0000)]
[llvm-profdata] Fix one bad format in llvm-profdata CommandGuide doc. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358643 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoElaborate why we have an option on by default for enabling chr.
Eric Christopher [Thu, 18 Apr 2019 06:17:40 +0000 (06:17 +0000)]
Elaborate why we have an option on by default for enabling chr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358641 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Avoid DAG combining assert with fneg(fadd(A,0))
Tim Renouf [Thu, 18 Apr 2019 05:27:01 +0000 (05:27 +0000)]
[AMDGPU] Avoid DAG combining assert with fneg(fadd(A,0))

fneg combining attempts to turn it into fadd(fneg(A), fneg(0)), but
creating the new fadd folds to just fneg(A). When A has multiple uses,
this confuses it and you get an assert. Fixed.

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

Change-Id: I0ddc9b7286abe78edc0cd8d734fdeb05ff09821c

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358640 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix a typo in comments. [NFC]
Ali Tamur [Thu, 18 Apr 2019 02:39:37 +0000 (02:39 +0000)]
Fix a typo in comments. [NFC]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358639 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GISel]:IRTranslator: Prefer a buidInstr form that allows CSE of cast instructions
Aditya Nandakumar [Thu, 18 Apr 2019 02:19:29 +0000 (02:19 +0000)]
[GISel]:IRTranslator: Prefer a buidInstr form that allows CSE of cast instructions

https://reviews.llvm.org/D60844

Use the style of buildInstr that allows CSEing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358637 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix bad compare function over FusionCandidate.
Richard Trieu [Thu, 18 Apr 2019 01:39:45 +0000 (01:39 +0000)]
Fix bad compare function over FusionCandidate.

Reverse the checking of the domiance order so that when a self compare happens,
it returns false.  This makes compare function have strict weak ordering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358636 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert Implement sys::fs::copy_file using the macOS copyfile(3) API to support APFS...
Adrian Prantl [Thu, 18 Apr 2019 01:21:10 +0000 (01:21 +0000)]
Revert Implement sys::fs::copy_file using the macOS copyfile(3) API to support APFS clones.

This reverts r358628 (git commit 91a06bee788262a294527b815354f380d99dfa9b)
while investigating a crash reproducer bot failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358634 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoImplement sys::fs::copy_file using the macOS copyfile(3) API
Adrian Prantl [Thu, 18 Apr 2019 00:01:05 +0000 (00:01 +0000)]
Implement sys::fs::copy_file using the macOS copyfile(3) API
to support APFS clones.

This patch adds a Darwin-specific implementation of
llvm::sys::fs::copy_file() that uses the macOS copyfile(3) API to
support APFS copy-on-write clones, which should be faster and much
more space efficient.

https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/APFS_Guide/ToolsandAPIs/ToolsandAPIs.html

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358628 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix formatting. NFC
Akira Hatanaka [Wed, 17 Apr 2019 23:14:39 +0000 (23:14 +0000)]
Fix formatting. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358623 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] try to widen 'shl' as part of LEA formation
Sanjay Patel [Wed, 17 Apr 2019 22:38:51 +0000 (22:38 +0000)]
[x86] try to widen 'shl' as part of LEA formation

The test file has pairs of tests that are logically equivalent:
https://rise4fun.com/Alive/2zQ

%t4 = and i8 %t1, 8
%t5 = zext i8 %t4 to i16
%sh = shl i16 %t5, 2
%t6 = add i16 %sh, %t0
=>
%t4 = and i8 %t1, 8
%sh2 = shl i8 %t4, 2
%z5 = zext i8 %sh2 to i16
%t6 = add i16 %z5, %t0

...so if we can fold the shift op into LEA in the 1st pattern, then we
should be able to do the same in the 2nd pattern (unnecessary 'movzbl'
is a separate bug I think).

We don't want to do this any sooner though because that would conflict
with generic transforms that try to narrow the width of the shift.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358622 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTest commit by Denis Bakhvalov
Denis Bakhvalov [Wed, 17 Apr 2019 22:27:30 +0000 (22:27 +0000)]
Test commit by Denis Bakhvalov

Change-Id: I4d85123a157d957434902fb14ba50926b2d56212

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358619 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AsmPrinter] hoist %a output template to base class for ARM+Aarch64
Nick Desaulniers [Wed, 17 Apr 2019 22:21:10 +0000 (22:21 +0000)]
[AsmPrinter] hoist %a output template to base class for ARM+Aarch64

Summary:
X86 is quite complicated; so I intend to leave it as is. ARM+Aarch64 do
basically the same thing (Aarch64 did not correctly handle immediates,
ARM has a test llvm/test/CodeGen/ARM/2009-04-06-AsmModifier.ll that uses
%a with an immediate) for a flag that should be target independent
anyways.

Reviewers: echristo, peter.smith

Reviewed By: echristo

Subscribers: javed.absar, eraman, kristof.beyls, hiraditya, llvm-commits, srhines

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358618 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd a getSizeInBits() accessor to MachineMemOperand. NFC.
Amara Emerson [Wed, 17 Apr 2019 22:21:05 +0000 (22:21 +0000)]
Add a getSizeInBits() accessor to MachineMemOperand. NFC.

Cleans up a bunch of places where we do getSize() * 8.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358617 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel] Add legalization support for non-power-2 loads and stores
Amara Emerson [Wed, 17 Apr 2019 21:30:07 +0000 (21:30 +0000)]
[GlobalISel] Add legalization support for non-power-2 loads and stores

Legalize things like i24 load/store by splitting them into smaller power of 2 operations.

This matches how SelectionDAG handles these operations.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358613 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd basic loop fusion pass.
Kit Barton [Wed, 17 Apr 2019 18:53:27 +0000 (18:53 +0000)]
Add basic loop fusion pass.

This patch adds a basic loop fusion pass. It will fuse loops that conform to the
following 4 conditions:
  1. Adjacent (no code between them)
  2. Control flow equivalent (if one loop executes, the other loop executes)
  3. Identical bounds (both loops iterate the same number of iterations)
  4. No negative distance dependencies between the loop bodies.

The pass does not make any changes to the IR to create opportunities for fusion.
Instead, it checks if the necessary conditions are met and if so it fuses two
loops together.

The pass has not been added to the pass pipeline yet, and thus is not enabled by
default. It can be run stand alone using the -loop-fusion option.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358607 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AsmPrinter] defer %c to base class for ARM, PPC, and Hexagon. NFC
Nick Desaulniers [Wed, 17 Apr 2019 18:22:48 +0000 (18:22 +0000)]
[AsmPrinter] defer %c to base class for ARM, PPC, and Hexagon. NFC

Summary:
None of these derived classes do anything that the base class cannot.
If we remove these case statements, then the base class can handle them
just fine.

Reviewers: peter.smith, echristo

Reviewed By: echristo

Subscribers: nemanjai, javed.absar, eraman, kristof.beyls, hiraditya, kbarton, jsji, llvm-commits, srhines

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358603 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols
Steven Wu [Wed, 17 Apr 2019 17:38:09 +0000 (17:38 +0000)]
[ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols

Summary:
Reapply r357931 with fixes to ThinLTO testcases and llvm-lto tool.

ThinLTOCodeGenerator currently does not preserve llvm.used symbols and
it can internalize them. In order to pass the necessary information to the
legacy ThinLTOCodeGenerator, the input to the code generator is
rewritten to be based on lto::InputFile.

Now ThinLTO using the legacy LTO API will requires data layout in
Module.

"internalize" thinlto action in llvm-lto is updated to run both
"promote" and "internalize" with the same configuration as
ThinLTOCodeGenerator. The old "promote" + "internalize" option does not
produce the same output as ThinLTOCodeGenerator.

This fixes: PR41236
rdar://problem/49293439

Reviewers: tejohnson, pcc, kromanova, dexonsmith

Reviewed By: tejohnson

Subscribers: ormris, bd1976llvm, mehdi_amini, inglorion, eraman, hiraditya, jkorous, dexonsmith, arphaman, dang, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358601 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Factor out unreachable inst idiom creation [NFC]
Philip Reames [Wed, 17 Apr 2019 17:37:58 +0000 (17:37 +0000)]
[InstCombine] Factor out unreachable inst idiom creation [NFC]

In InstCombine, we use an idiom of "store i1 true, i1 undef" to indicate we've found a path which we've proven unreachable.  We can't actually insert the unreachable instruction since that would require changing the CFG.  We leave that to simplifycfg later.

This just factors out that idiom creation so we don't duplicate the same mostly undocument idiom creation in multiple places.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358600 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LVI][CVP] Constrain values in with.overflow branches
Nikita Popov [Wed, 17 Apr 2019 16:57:42 +0000 (16:57 +0000)]
[LVI][CVP] Constrain values in with.overflow branches

If a branch is conditional on extractvalue(op.with.overflow(%x, C), 1)
then we can constrain the value of %x inside the branch based on
makeGuaranteedNoWrapRegion(). We do this by extending the edge-value
handling in LVI. This allows CVP to then fold comparisons against %x,
as illustrated in the tests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358597 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU][MC] Corrected handling of "-" before expressions
Dmitry Preobrazhensky [Wed, 17 Apr 2019 16:56:34 +0000 (16:56 +0000)]
[AMDGPU][MC] Corrected handling of "-" before expressions

See bug 41156: https://bugs.llvm.org/show_bug.cgi?id=41156

Reviewers: artem.tamazov, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358596 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] tighten test checks; NFC
Sanjay Patel [Wed, 17 Apr 2019 16:51:09 +0000 (16:51 +0000)]
[ARM] tighten test checks; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358594 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Force skip over SMRD, VMEM and s_waitcnt instructions
Rhys Perry [Wed, 17 Apr 2019 16:31:52 +0000 (16:31 +0000)]
AMDGPU: Force skip over SMRD, VMEM and s_waitcnt instructions

Summary: This fixes a large Dawn of War 3 performance regression with RADV from Mesa 19.0 to master which was caused by creating less code in some branches.

Reviewers: arsen, nhaehnle

Reviewed By: nhaehnle

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358592 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] make test checks more thorough; NFC
Sanjay Patel [Wed, 17 Apr 2019 16:02:07 +0000 (16:02 +0000)]
[ARM] make test checks more thorough; NFC

This will change with the proposal in D60214.
Unfortunately, the triple is not supported for auto-generation
via script, and the multiple RUN lines have diffs on this test,
but I can't tell exactly what is required by this test.
PR7162 was an assert/crash, so hopefully, this is good enough.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358587 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LoopUnroll] Allow unrolling if the unrolled size does not exceed loop size.
Florian Hahn [Wed, 17 Apr 2019 15:57:43 +0000 (15:57 +0000)]
[LoopUnroll] Allow unrolling if the unrolled size does not exceed loop size.

Summary:
In the following cases, unrolling can be beneficial, even when
optimizing for code size:
 1) very low trip counts
 2) potential to constant fold most instructions after fully unrolling.

We can unroll in those cases, by setting the unrolling threshold to the
loop size. This might highlight some cost modeling issues and fixing
them will have a positive impact in general.

Reviewers: vsk, efriedma, dmgreen, paquette

Reviewed By: paquette

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358586 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombine] Add SimplifyDemandedBits helper that handles demanded elts mask as well
Simon Pilgrim [Wed, 17 Apr 2019 15:45:44 +0000 (15:45 +0000)]
[DAGCombine] Add SimplifyDemandedBits helper that handles demanded elts mask as well

The other SimplifyDemandedBits helpers become wrappers to this new demanded elts variant.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358585 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Support] Add LEB128 support to BinaryStreamReader/Writer.
Lang Hames [Wed, 17 Apr 2019 15:38:27 +0000 (15:38 +0000)]
[Support] Add LEB128 support to BinaryStreamReader/Writer.

Summary:
This patch adds support for ULEB128 and SLEB128 encoding and decoding to
BinaryStreamWriter and BinaryStreamReader respectively.

Support for ULEB128/SLEB128 will be used for eh-frame parsing in the JITLink
library currently under development (see https://reviews.llvm.org/D58704).

Reviewers: zturner, dblaikie

Subscribers: kristina, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358584 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ScheduleDAGRRList] Recompute topological ordering on demand.
Florian Hahn [Wed, 17 Apr 2019 15:05:29 +0000 (15:05 +0000)]
[ScheduleDAGRRList] Recompute topological ordering on demand.

Currently there is a single point in ScheduleDAGRRList, where we
actually query the topological order (besides init code). Currently we
are recomputing the order after adding a node (which does not have
predecessors) and then we add predecessors edge-by-edge.

We can avoid adding edges one-by-one after we added a new node. In that case, we can
just rebuild the order from scratch after adding the edges to the DAG
and avoid all the updates to the ordering.

Also, we can delay updating the DAG until we query the DAG, if we keep a
list of added edges. Depending on the number of updates, we can either
apply them when needed or recompute the order from scratch.

This brings down the geomean compile time for of CTMark with -O1 down 0.3% on X86,
with no regressions.

Reviewers: MatzeB, atrick, efriedma, niravd, paquette

Reviewed By: efriedma

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358583 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU][MC] Corrected parsing of registers
Dmitry Preobrazhensky [Wed, 17 Apr 2019 14:44:01 +0000 (14:44 +0000)]
[AMDGPU][MC] Corrected parsing of registers

See bug 41280: https://bugs.llvm.org/show_bug.cgi?id=41280

Reviewers: artem.tamazov, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358581 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Flag new raw/struct atomic ops as source of divergence
Tim Renouf [Wed, 17 Apr 2019 14:04:31 +0000 (14:04 +0000)]
[AMDGPU] Flag new raw/struct atomic ops as source of divergence

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

Change-Id: I821d93dec8b9cdd247b8172d92fb5e15340a9e7d

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358579 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r358554
Nico Weber [Wed, 17 Apr 2019 13:40:57 +0000 (13:40 +0000)]
gn build: Merge r358554

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358578 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LLVM-C] Add DIFile Field Accesssors
Robert Widmann [Wed, 17 Apr 2019 13:29:14 +0000 (13:29 +0000)]
[LLVM-C] Add DIFile Field Accesssors

Summary:
Add accessors for the file, directory, source file name (curiously, an `Optional` value?), of a DIFile.

This is intended to replace the LLVMValueRef-based accessors used in D52239

Reviewers: whitequark, jberdine, deadalnix

Reviewed By: whitequark, jberdine

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358577 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CostModel][X86] Add bool anyof/allof reduction costs
Simon Pilgrim [Wed, 17 Apr 2019 10:58:19 +0000 (10:58 +0000)]
[CostModel][X86] Add bool anyof/allof reduction costs

On pre-AVX512 targets we can use MOVMSK to extract reduced boolean results. This is properly optimized, annoyingly AVX512 isn't and produces code that is almost as bad as the (unchanged) costs suggest......

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358574 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DWARF] llvm::Error -> Error. NFC
Fangrui Song [Wed, 17 Apr 2019 09:11:08 +0000 (09:11 +0000)]
[DWARF] llvm::Error -> Error. NFC

The unqualified name is more common and is used in the file as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358567 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoChange some llvm::{lower,upper}_bound to llvm::bsearch. NFC
Fangrui Song [Wed, 17 Apr 2019 07:58:05 +0000 (07:58 +0000)]
Change some llvm::{lower,upper}_bound to llvm::bsearch. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358564 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objcopy] Support full list of bfd targets that lld uses.
Jordan Rupprecht [Wed, 17 Apr 2019 07:42:31 +0000 (07:42 +0000)]
[llvm-objcopy] Support full list of bfd targets that lld uses.

Summary:
This change takes the full list of bfd targets that lld supports (see `ScriptParser.cpp`), including generic handling for `*-freebsd` targets (which uses the same settings but with a FreeBSD OSABI). In particular this adds mips support for `--output-target` (but not yet via `--binary-architecture`).

lld and llvm-objcopy use their own different custom data structures, so I'd prefer to check this in as-is (add support directly in llvm-objcopy, including all the test coverage) and do a separate NFC patch(s) that consolidate the two by putting this mapping into libobject.

See [[ https://bugs.llvm.org/show_bug.cgi?id=41462 | PR41462 ]].

Reviewers: jhenderson, jakehehrlich, espindola, alexshap, arichardson

Reviewed By: arichardson

Subscribers: fedor.sergeev, emaste, sdardis, krytarowski, atanasyan, llvm-commits, MaskRay, arichardson

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358562 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CVP] processOverflowIntrinsic(): don't crash if constant-holding happened
Roman Lebedev [Wed, 17 Apr 2019 06:35:07 +0000 (06:35 +0000)]
[CVP] processOverflowIntrinsic(): don't crash if constant-holding happened

As reported by Mikael Holmén in post-commit review in
https://reviews.llvm.org/D60791#1469765

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358559 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DWARF] Pass ReferenceToDIEOffsets elements by reference
Fangrui Song [Wed, 17 Apr 2019 06:33:52 +0000 (06:33 +0000)]
[DWARF] Pass ReferenceToDIEOffsets elements by reference

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358558 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFixed error message printing in write_cmake_config.py
Dmitri Gribenko [Wed, 17 Apr 2019 06:11:27 +0000 (06:11 +0000)]
Fixed error message printing in write_cmake_config.py

Summary:
Previously, write_cmake_config.py would raise an error while printing
the error, because `leftovers` in "'\n'.join(leftovers)" is a tuple.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358557 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Wed, 17 Apr 2019 06:09:16 +0000 (06:09 +0000)]
[X86] Autogenerate complete checks. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358556 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] In CopyToFromAsymmetricReg, use VR128 instead of FR32 instructions for GR32...
Craig Topper [Wed, 17 Apr 2019 06:09:11 +0000 (06:09 +0000)]
[X86] In CopyToFromAsymmetricReg, use VR128 instead of FR32 instructions for GR32<->XMM register copies.

We have two versions of some instructions, VR128 versions and FR32 versions that
are marked as CodeGenOnly.

This change switches to using the VR128 versions for these copies. It's after
register allocation so the class size no longer matters. This matches how GR64
works.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358555 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MCA] Moved the bottleneck analysis to its own file. NFCI
Andrea Di Biagio [Wed, 17 Apr 2019 06:02:05 +0000 (06:02 +0000)]
[MCA] Moved the bottleneck analysis to its own file. NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358554 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "Add basic loop fusion pass." Per request.
Eric Christopher [Wed, 17 Apr 2019 04:55:24 +0000 (04:55 +0000)]
Revert "Add basic loop fusion pass." Per request.

This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358553 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "Temporarily Revert "Add basic loop fusion pass.""
Eric Christopher [Wed, 17 Apr 2019 04:52:47 +0000 (04:52 +0000)]
Revert "Temporarily Revert "Add basic loop fusion pass.""

The reversion apparently deleted the test/Transforms directory.

Will be re-reverting again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358552 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove the run-slp-after-loop-vectorization option.
Eric Christopher [Wed, 17 Apr 2019 02:26:27 +0000 (02:26 +0000)]
Remove the run-slp-after-loop-vectorization option.

It's been on by default for 4 years and cleans up the pass
hierarchy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358548 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTemporarily Revert "Add basic loop fusion pass."
Eric Christopher [Wed, 17 Apr 2019 02:12:23 +0000 (02:12 +0000)]
Temporarily Revert "Add basic loop fusion pass."
As it's causing some bot failures (and per request from kbarton).

This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358546 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd basic loop fusion pass.
Kit Barton [Wed, 17 Apr 2019 01:37:00 +0000 (01:37 +0000)]
Add basic loop fusion pass.

This patch adds a basic loop fusion pass. It will fuse loops that conform to the
following 4 conditions:
  1. Adjacent (no code between them)
  2. Control flow equivalent (if one loop executes, the other loop executes)
  3. Identical bounds (both loops iterate the same number of iterations)
  4. No negative distance dependencies between the loop bodies.

The pass does not make any changes to the IR to create opportunities for fusion.
Instead, it checks if the necessary conditions are met and if so it fuses two
loops together.

The pass has not been added to the pass pipeline yet, and thus is not enabled by
default. It can be run stand alone using the -loop-fusion option.

Phabricator: https://reviews.llvm.org/D55851

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358543 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ADT] llvm::bsearch, binary search for mere mortals
Sam McCall [Tue, 16 Apr 2019 23:53:28 +0000 (23:53 +0000)]
[ADT] llvm::bsearch, binary search for mere mortals

Summary:
Add to STLExtras a binary search function with a simple mental model:
You provide a range and a predicate which is true above a certain point.
bsearch() tells you that point.
Overloads are provided for integers, iterators, and containers.

This is more suitable than std:: alternatives in many cases:
 - std::binary_search only indicates presence/absence
 - upper_bound/lower_bound give you the opportunity to pick the wrong one
 - all of the options have confusing names and definitions when your predicate
   doesn't have simple "less than" semantics
 - all of the options require iterators
 - we plumb around a useless `value` parameter that should be a lambda capture

The API is inspired by Go's standard library, but we add an extra parameter as
well as some overloads and templates to show how clever C++ is.

Reviewers: ilya-biryukov, gribozavr

Subscribers: dexonsmith, kristina, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358540 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] adjust LEA tests for better coverage; NFC
Sanjay Patel [Tue, 16 Apr 2019 23:10:41 +0000 (23:10 +0000)]
[x86] adjust LEA tests for better coverage; NFC

The scale can 1, 2, or 3.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358539 91177308-0d34-0410-b5e6-96231b3b80d8