19734 Commits

Author SHA1 Message Date
Nico Weber
9387b39048 Remove trailing space in build file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329479 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-07 03:30:28 +00:00
Vitaly Buka
af98dad7c6 Fix warning by cl::opt<int> -> cl::opt<unsigned>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329461 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 21:41:17 +00:00
Vitaly Buka
b67d096388 Runtime flag to control branch funnel threshold
Reviewers: pcc

Subscribers: hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329459 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 21:32:36 +00:00
Geoff Berry
0f09c5e66a [EarlyCSE] Add debug counter for debugging mis-optimizations. NFC.
Reviewers: reames, spatel, davide, dberlin

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329443 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 18:47:33 +00:00
Sanjay Patel
d637812084 [InstCombine] limit nsz: -(X - Y) --> Y - X to hasOneUse()
As noted in the post-commit discussion for r329350, we shouldn't
generally assume that fsub is the same cost as fneg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329429 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 17:24:08 +00:00
Simon Pilgrim
4f4a276183 Strip trailing whitespace. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329421 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 17:01:54 +00:00
Mircea Trofin
85b0c0c8f0 [GlobalOpt] Fix support for casts in ctors.
Summary:
Fixing an issue where initializations of globals where constructors use
casts were silently translated to 0-initialization.

Reviewers: davidxl, evgeny777

Reviewed By: evgeny777

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329409 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 15:54:47 +00:00
Chad Rosier
15b5be3513 [LoopUnroll] Make LoopPeeling respect the AllowPeeling preference.
The SimpleLoopUnrollPass isn't suppose to perform loop peeling.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329395 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 13:57:21 +00:00
Hans Wennborg
5f10dae16e EntryExitInstrumenter: Handle musttail calls
Inserting instrumentation between a musttail call and ret instruction
would create invalid IR. Instead, treat musttail calls as function
exits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329385 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 10:14:09 +00:00
Max Kazantsev
deaebefed8 [NFC] Add missing end of line symbols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329383 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 09:47:06 +00:00
Sanjay Patel
06426a9f21 [InstCombine] FP: Z - (X - Y) --> Z + (Y - X)
This restores what was lost with rL73243 but without
re-introducing the bug that was present in the old code.

Note that we already have these transforms if the ops are 
marked 'fast' (and I assume that's happening somewhere in
the code added with rL170471), but we clearly don't need 
all of 'fast' for these transforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329362 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 23:21:15 +00:00
Sanjay Patel
bd62cc1c78 [InstCombine] nsz: -(X - Y) --> Y - X
This restores part of the fold that was removed with rL73243 (PR4374).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329350 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 21:37:17 +00:00
Daniel Neilson
ef973e5f0a [InstCombine] Properly change GEP type when reassociating loop invariant GEP chains
Summary:
This is a fix to PR37005.

Essentially, rL328539 ([InstCombine] reassociate loop invariant GEP chains to enable LICM) contains a bug
whereby it will convert:
%src = getelementptr inbounds i8, i8* %base, <2 x i64> %val
%res = getelementptr inbounds i8, <2 x i8*> %src, i64 %val2
into:
%src = getelementptr inbounds i8, i8* %base, i64 %val2
%res = getelementptr inbounds i8, <2 x i8*> %src, <2 x i64> %val

By swapping the index operands if the GEPs are in a loop, and %val is loop variant while %val2
is loop invariant.

This fix recreates new GEP instructions if the index operand swap would result in the type
of %src changing from vector to scalar, or vice versa.

Reviewers: sebpop, spatel

Reviewed By: sebpop

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329331 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 18:51:45 +00:00
Sanjay Patel
4736168ad5 [InstCombine] use pattern matchers for fsub --> fadd folds
This allows folding for vectors with undef elements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329316 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 17:06:45 +00:00
Sanjay Patel
7d31ac8415 [InstCombine] cleanup; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329282 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 13:24:26 +00:00
Florian Hahn
af1e56959c [LoopInterchange] Add stats counter for number of interchanged loops.
Reviewers: samparker, karthikthecool, blitz.opensource

Reviewed By: samparker

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329269 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 10:39:23 +00:00
Florian Hahn
49d9dfff54 [LoopInterchange] Preserve LoopInfo after interchanging.
LoopInterchange relies on LoopInfo being up-to-date, so we should
preserve it after interchanging. This patch updates restructureLoops to
move the BBs of the interchanged loops to the right place.

Reviewers: davide, efriedma, karthikthecool, mcrosier

Reviewed By: efriedma

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329264 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 09:48:45 +00:00
Taewook Oh
68c702b4ee [CallSiteSplitting] Do not perform callsite splitting inside landing pad
Summary:
If the callsite is inside landing pad, do not perform callsite splitting.

Callsite splitting uses utility function llvm::DuplicateInstructionsInSplitBetween, which eventually calls llvm::SplitEdge. llvm::SplitEdge calls llvm::SplitCriticalEdge with an assumption that the function returns nullptr only when the target edge is not a critical edge (and further assumes that if the return value was not nullptr, the predecessor of the original target edge always has a single successor because critical edge splitting was successful). However, this assumtion is not true because SplitCriticalEdge returns nullptr if the destination block is a landing pad. This invalid assumption results assertion failure.

Fundamental solution might be fixing llvm::SplitEdge to not to rely on the invalid assumption. However, it'll involve a lot of work because current API assumes that llvm::SplitEdge never fails. Instead, this patch makes callsite splitting to not to attempt splitting if the callsite is in a landing pad.

Attached test case will crash with assertion failure without the fix.

Reviewers: fhahn, junbuml, dberlin

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329250 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 04:16:23 +00:00
Evgeniy Stepanov
b7b2c0a7bb hwasan: add -hwasan-match-all-tag flag
Sometimes instead of storing addresses as is, the kernel stores the address of
a page and an offset within that page, and then computes the actual address
when it needs to make an access. Because of this the pointer tag gets lost
(gets set to 0xff). The solution is to ignore all accesses tagged with 0xff.

This patch adds a -hwasan-match-all-tag flag to hwasan, which allows to ignore
accesses through pointers with a particular pointer tag value for validity.

Patch by Andrey Konovalov.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329228 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-04 20:44:59 +00:00
Benjamin Kramer
ab9704d95e Make helpers static. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329170 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-04 11:45:11 +00:00
Nicolai Haehnle
036d645a4c StructurizeCFG: Test for branch divergence correctly
Fixes cases like the new test @nonuniform. In that test, %cc itself
is a uniform value; however, when reading it after the end of the loop in
basic block %if, its value is effectively non-uniform, so the branch is
non-uniform.

This problem was encountered in
https://bugs.freedesktop.org/show_bug.cgi?id=103743; however, this change
in itself is not sufficient to fix that bug, as there is another issue
in the AMDGPU backend.

As discovered after committing an earlier version of this change, this
exposes a subtle interaction between this pass and DivergenceAnalysis:
since we remove and re-create branch instructions, we can no longer rely
on DivergenceAnalysis for branches in subregions that were already
processed by the pass.

Explicitly remove branch instructions from DivergenceAnalysis to
avoid dangling pointers as a matter of defensive programming, and
change how we detect non-uniform subregions.

Change-Id: I32bbffece4a32f686fab54964dae1a5dd72949d4

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329165 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-04 10:58:15 +00:00
Craig Topper
bc032eba1e [SimplifyCFG] Teach merge conditional stores to handle cases where the PostBB has more than 2 predecessors by inserting a new block for the store.
Summary:
Currently merge conditional stores can't handle cases where PostBB (the block we need to move the store to) has more than 2 predecessors.

This patch removes that restriction by creating a new block with only the 2 predecessors we care about and an unconditional branch to the original block. This provides a place to put the store.

Reviewers: efriedma, jmolloy, ABataev

Reviewed By: efriedma

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329142 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-04 03:47:17 +00:00
Ikhlas Ajbar
7c6b96497b [Hexagon] peel loops with runtime small trip counts
Move the check canPeel() to Hexagon Target before setting PeelCount.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329129 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 22:55:09 +00:00
Sanjay Patel
e0ab896a84 [InstCombine] allow more fmul folds with 'reassoc'
The tests marked with 'FIXME' require loosening the check
in SimplifyAssociativeOrCommutative() to optimize completely;
that's still checking isFast() in Instruction::isAssociative().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329121 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 22:19:19 +00:00
Vlad Tsyrklevich
fa13e5dd1d Fix bad copy-and-paste in r329108
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329118 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 21:40:27 +00:00
Gor Nishanov
d36a0f0f41 [coroutines] Respect alloca alignment requirements when building coroutine frame
Summary:
If an alloca need to be stored in the coroutine frame and it has an alignment specified and the alignment does not match the natural alignment of the alloca type. Insert appropriate padding into the coroutine frame to make sure that it gets requested alignment.

For example for a packet type (which natural alignment is 1), but alloca alignment is 8, we may need to insert a padding field with required number of bytes to make sure it is properly aligned.

```
%PackedStruct = type <{ i64 }>
...
  %data = alloca %PackedStruct, align 8
```

If the previous field in the coroutine frame had alignment 2, we would have [6 x i8] inserted before %PackedStruct in the coroutine frame:

```
%f.Frame = type { ..., i16, [6 x i8], %PackedStruct }
```

Reviewers: rnk, lewissbaker, modocache

Reviewed By: modocache

Subscribers: EricWF, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329112 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 20:54:20 +00:00
Florian Hahn
e37502533b [LoopInterchange] Add remark for calls preventing interchanging.
It also updates test/Transforms/LoopInterchange/call-instructions.ll
to use accesses where we can prove dependence after D35430.


Reviewers: sebpop, karthikthecool, blitz.opensource

Reviewed By: sebpop

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329111 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 20:54:04 +00:00
Vlad Tsyrklevich
45013b2e67 Add the ShadowCallStack attribute
Summary:
Introduce the ShadowCallStack function attribute. It's added to
functions compiled with -fsanitize=shadow-call-stack in order to mark
functions to be instrumented by a ShadowCallStack pass to be submitted
in a separate change.

Reviewers: pcc, kcc, kubamracek

Reviewed By: pcc, kcc

Subscribers: cryptoad, mehdi_amini, javed.absar, llvm-commits, kcc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329108 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 20:10:40 +00:00
Alexey Bataev
4785e67b24 [SLP] Fixed formatting, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329091 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 17:48:14 +00:00
Daniel Neilson
36d6cce30a [InstCombine] Fold compare of int constant against a splatted vector of ints
Summary:
Folding patterns like:
  %vec = shufflevector <4 x i8> %insvec, <4 x i8> undef, <4 x i32> zeroinitializer
  %cast = bitcast <4 x i8> %vec to i32
  %cond = icmp eq i32 %cast, 0
into:
  %ext = extractelement <4 x i8> %insvec, i32 0
  %cond = icmp eq i32 %ext, 0

Combined with existing rules, this allows us to fold patterns like:
  %insvec = insertelement <4 x i8> undef, i8 %val, i32 0
  %vec = shufflevector <4 x i8> %insvec, <4 x i8> undef, <4 x i32> zeroinitializer
  %cast = bitcast <4 x i8> %vec to i32
  %cond = icmp eq i32 %cast, 0
into:
  %cond = icmp eq i8 %val, 0

When we construct a splat vector via a shuffle, and bitcast the vector into an integer type for comparison against an integer constant. Then we can simplify the the comparison to compare the splatted value against the integer constant.

Reviewers: spatel, anna, mkazantsev

Reviewed By: spatel

Subscribers: efriedma, rengolin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329087 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 17:26:20 +00:00
Alexey Bataev
91811bc488 [SLP] Fix PR36481: vectorize reassociated instructions.
Summary:
If the load/extractelement/extractvalue instructions are not originally
consecutive, the SLP vectorizer is unable to vectorize them. Patch
allows reordering of such instructions.

Patch does not support reordering of the repeated instruction, this must
be handled in the separate patch.

Reviewers: RKSimon, spatel, hfinkel, mkuper, Ayal, ashahid

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329085 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 17:14:47 +00:00
Alexey Bataev
b09f726df5 Recommit "[SLP] Fix issues with debug output in the SLP vectorizer."
The primary issue here is that using NDEBUG alone isn't enough to guard
debug printing -- instead the DEBUG() macro needs to be used so that the
specific pass debug logging check is employed. Without this, every
asserts-enabled build was printing out information when it hit this.

I also fixed another place where we had multiple statements in a DEBUG
macro to use {}s to be a bit cleaner. And I fixed a place that used
errs() rather than dbgs().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329082 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 16:40:33 +00:00
Benjamin Kramer
4832f865cf Revert "[SLP] Fix PR36481: vectorize reassociated instructions."
This reverts commit r328980 and r329046. Makes the vectorizer crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329071 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 14:40:33 +00:00
Alexander Potapenko
a05cf8130c MSan: introduce the conservative assembly handling mode.
The default assembly handling mode may introduce false positives in the
cases when MSan doesn't understand that the assembly call initializes
the memory pointed to by one of its arguments.

We introduce the conservative mode, which initializes the first
|sizeof(type)| bytes for every |type*| pointer passed into the
assembly statement.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329054 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 09:50:06 +00:00
Chandler Carruth
8b74007e1a [SLP] Fix issues with debug output in the SLP vectorizer.
The primary issue here is that using NDEBUG alone isn't enough to guard
debug printing -- instead the DEBUG() macro needs to be used so that the
specific pass debug logging check is employed. Without this, every
asserts-enabled build was printing out information when it hit this.

I also fixed another place where we had multiple statements in a DEBUG
macro to use {}s to be a bit cleaner. And I fixed a place that used
`errs()` rather than `dbgs()`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329046 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 05:27:28 +00:00
Ikhlas Ajbar
746a5dcae6 peel loops with runtime small trip counts
For Hexagon, peeling loops with small runtime trip count is beneficial for our
benchmarks. We set PeelCount in HexagonTargetInfo.cpp and we use PeelCount set
by the target for computing the desired peel count.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329042 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 03:39:43 +00:00
Haicheng Wu
2784c35c0f [SLP] Distinguish "demanded and shrinkable" from "demanded and not shrinkable" values when determining the minimum bitwidth
We use two approaches for determining the minimum bitwidth.

   * Demanded bits
   * Value tracking

If demanded bits doesn't result in a narrower type, we then try value tracking.
We need this if we want to root SLP trees with the indices of getelementptr
instructions since all the bits of the indices are demanded.

But there is a missing piece though. We need to be able to distinguish "demanded
and shrinkable" from "demanded and not shrinkable". For example, the bits of %i
in

%i = sext i32 %e1 to i64
%gep = getelementptr inbounds i64, i64* %p, i64 %i

are demanded, but we can shrink %i's type to i32 because it won't change the
result of the getelementptr. On the other hand, in

%tmp15 = sext i32 %tmp14 to i64
%tmp16 = insertvalue { i64, i64 } undef, i64 %tmp15, 0

it doesn't make sense to shrink %tmp15 and we can skip the value tracking.

Ideas are from Matthew Simpson!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329035 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 00:05:10 +00:00
Brian Gesiak
64543f4027 [Coroutines] Avoid assert splitting hidden coros
Summary:
When attempting to split a coroutine with 'hidden' visibility (for
example, a C++ coroutine that is inlined when compiled with the option
'-fvisibility-inlines-hidden'), LLVM would hit an assertion in
include/llvm/IR/GlobalValue.h:240: "local linkage requires default
visibility". The issue is that the visibility is copied from the source
of the function split in the `CloneFunctionInto` function, but the linkage
is not. To fix, create the new function first with external linkage,
then copy the linkage from the original function *after* `CloneFunctionInto`
is called.

Since `GlobalValue::setLinkage` in turn calls `maybeSetDsoLocal`, the
explicit call to `setDSOLocal` can be removed in CoroSplit.cpp.

Test Plan: check-llvm

Reviewers: GorNishanov, lewissbaker, EricWF, majnemer, rnk

Reviewed By: rnk

Subscribers: llvm-commits, eric_niebler

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329033 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-02 23:39:40 +00:00
Reid Kleckner
bc963136e0 [InstCombine] Don't strip function type casts from musttail calls
Summary:
The cast simplifications that instcombine does here do not make any
attempt to obey the verifier rules for musttail calls. Therefore we have
to disable them.

Reviewers: efriedma, majnemer, pcc

Subscribers: hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329027 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-02 22:49:44 +00:00
Reid Kleckner
543b638e89 Treat inlining a notail call as a regular, non-tail call
Otherwise, we end up inlining a musttail call into a non-tail position,
which breaks verifier invariants.

Fixes PR31014

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329015 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-02 21:23:16 +00:00
Sanjay Patel
01621ff0d6 [InstCombine] add folds for icmp + sub (PR36969)
(A - B) >u A --> A <u B
C <u (C - D) --> C <u D

https://rise4fun.com/Alive/e7j

Name: ugt
  %sub = sub i8 %x, %y
  %cmp = icmp ugt i8 %sub, %x
=>
  %cmp = icmp ult i8 %x, %y
  
Name: ult
  %sub = sub i8 %x, %y
  %cmp = icmp ult i8 %x, %sub
=>
  %cmp = icmp ult i8 %x, %y

This should fix:
https://bugs.llvm.org/show_bug.cgi?id=36969



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329011 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-02 20:37:40 +00:00
Rong Xu
282ca2a3b1 [DeadArgumentElim] Clone function level metadatas
Some Function level metadatas, such as function entry count, are not cloned in
DeadArgumentElim. This happens a lot in lto/thinlto because of DeadArgumentElim
after internalization.

This patch clones the metadatas in the original function to the new function.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328991 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-02 17:27:38 +00:00
Gor Nishanov
78cbb42d45 [coroutines] Add support for llvm.coro.noop intrinsics
Summary:
A recent addition to Coroutines TS (https://wg21.link/p0913) adds a pre-defined coroutine noop_coroutine that does nothing.
To implement this feature, we implemented an llvm.coro.noop intrinsic that returns a coroutine handle to a coroutine that does nothing when resumed or destroyed.

Reviewers: EricWF, modocache, rnk, lewissbaker

Reviewed By: modocache

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328986 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-02 16:55:12 +00:00
Alexey Bataev
6616787959 [SLP] Fix PR36481: vectorize reassociated instructions.
Summary:
If the load/extractelement/extractvalue instructions are not originally
consecutive, the SLP vectorizer is unable to vectorize them. Patch
allows reordering of such instructions.

Reviewers: RKSimon, spatel, hfinkel, mkuper, Ayal, ashahid

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328980 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-02 14:51:37 +00:00
Teresa Johnson
b1a5bd8ba9 [ThinLTO] Add an import cutoff for debugging/triaging
Summary:
Adds -import-cutoff=N which will stop importing during the thin link
after N imports. Default is -1 (no  limit).

Reviewers: wmi

Subscribers: inglorion, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328934 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-01 15:54:40 +00:00
David Green
a9bfe02006 [LoopRotate] Rotate loops with loop exiting latches
If a loop has a loop exiting latch, it can be profitable
to rotate the loop if it leads to the simplification of
a phi node. Perform rotation in these cases even if loop
rotate itself didnt simplify the loop to get there.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328933 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-01 12:48:24 +00:00
Fangrui Song
73d8dbf806 Fix a bunch of typoes. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328907 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-30 22:22:31 +00:00
Peter Collingbourne
9541cc2882 DataFlowSanitizer: wrappers of functions with local linkage should have the same linkage as the function being wrapped
This patch resolves link errors when the address of a static function is taken, and that function is uninstrumented by DFSan.

This change resolves bug 36314.

Patch by Sam Kerner!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328890 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-30 18:37:55 +00:00
Krzysztof Parzyszek
fa05c349cf Revert "peel loops with runtime small trip counts"
This reverts commit r328854, it breaks some Hexagon tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328875 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-30 16:55:44 +00:00
Ikhlas Ajbar
51feea5bc3 peel loops with runtime small trip counts
For Hexagon, peeling loops with small runtime trip count is beneficial for our
benchmarks. We set PeelCount in HexagonTargetInfo.cpp and we use PeelCount set
by the target for computing the desired peel count.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328854 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-30 03:05:34 +00:00