15734 Commits

Author SHA1 Message Date
Sean Silva
9968808357 Refactor - CodeExtractor : Move check for valid block to static utility
This lets you actually check to see if a block is valid before trying to
extract.

Patch by River Riddle!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276846 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-27 08:02:46 +00:00
George Burgess IV
7963f422e1 [GVNHoist] Fix typo in assert.
This fixes PR28730.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276844 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-27 06:34:53 +00:00
Sebastian Pop
7c4932c37d GVN-hoist: improve code generation for recursive GEPs
When loading or storing in a field of a struct like "a.b.c", GVN is able to
detect the equivalent expressions, and GVN-hoist would fail in the code
generation.  This is because the GEPs are not hoisted as scalar operations to
avoid moving the GEPs too far from their ld/st instruction when the ld/st is not
movable.  So we end up having to generate code for the GEP of a ld/st when we
move the ld/st.  In the case of a GEP referring to another GEP as in "a.b.c" we
need to code generate all the GEPs necessary to make all the operands available
at the new location for the ld/st.  With this patch we recursively walk through
the GEP operands checking whether all operands are available, and in the case of
a GEP operand, it recursively makes all its operands available. Code generation
happens from the inner GEPs out until reaching the GEP that appears as an
operand of the ld/st.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276841 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-27 05:48:12 +00:00
Sebastian Pop
c58cbcd10d GVN-hoist: use DFS numbers instead of walking the instruction stream
The patch replaces a function that walks the IR with a call to firstInBB() that
uses the DFS numbering.  NFC.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276840 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-27 05:13:52 +00:00
Andrew Kaylor
e60e6f6702 Reverting r276771 due to MSan failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276824 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-27 01:19:24 +00:00
Adam Nemet
0f30994ef7 [LoopUtils] Sort headers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276776 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 17:52:02 +00:00
Andrew Kaylor
04defbca9e Re-committing r275284: add support to inline __builtin_mempcpy
Patch by Sunita Marathe

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276771 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 17:23:13 +00:00
Sebastian Pop
2970c2210e GVN-hoist: use a DFS numbering of instructions (PR28670)
Instead of DFS numbering basic blocks we now DFS number instructions that avoids
the costly operation of which instruction comes first in a basic block.

Patch mostly written by Daniel Berlin.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276714 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 00:15:10 +00:00
Sebastian Pop
4df990e9af GVN-hoist: limit hoisting depth (PR28670)
This patch adds an option to specify the maximum depth in a BB at which to
consider hoisting instructions.  Hoisting instructions from a deeper level is
not profitable as it increases register pressure and compilation time.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276713 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 00:15:08 +00:00
Michael Kuperstein
b3391842c6 [PM] Port SymbolRewriter to the new PM
Differential Revision: https://reviews.llvm.org/D22703


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276687 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 20:52:00 +00:00
Matt Arsenault
dc848c22cc Scalarizer: Support scalarizing intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276681 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 20:02:54 +00:00
Rong Xu
568d841225 [PGO] Fix profile mismatch in COMDAT function with pre-inliner
Pre-instrumentation inline (pre-inliner) greatly improves the IR
instrumentation code performance, among other benefits. One issue of the
pre-inliner is it can introduce CFG-mismatch for COMDAT functions. This
is due to the fact that the same COMDAT function may have different early
inline decisions across different modules -- that means different copies
of COMDAT functions will have different CFG checksum.

In this patch, we propose a partially renaming the COMDAT group and its
member function/variable so we have different profile counter for each
version. We will post-fix the COMDAT function and the group name with its
FunctionHash.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276673 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 18:45:37 +00:00
Michael Kuperstein
8969e2c091 Attempt to pacify windows bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276672 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 18:39:08 +00:00
Daniel Berlin
5b3d02d932 Revert NewGVN N^2 behavior patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276670 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 18:19:49 +00:00
Michael Kuperstein
875b0da43f Don't use iplist in SymbolRewriter. NFC.
There didn't appear to be a good reason to use iplist in this case, a regular
list of unique_ptr works just as well.
Change made in preparation to a new PM port (since iplist is not moveable).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276668 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 18:10:54 +00:00
Daniel Berlin
d1e02cb9b3 NFC: Make a few asserts in GVNHoist do the same thing, but cheaper.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276662 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 17:36:14 +00:00
Daniel Berlin
9ad9fd46e0 Fix N^2 instruction ordering comparisons in GVNHoist.
This fixes GVNHoist's portion of PR28670.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276658 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 17:24:27 +00:00
Daniel Berlin
480806f7b1 NFC: Refactor GVNHoist class so not everything is public
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276657 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 17:24:22 +00:00
Sean Silva
9728cbe338 Cleanup : Reformat PartialInliner.cpp to have current LLVM style conventions
Modify the variable names and code style to be that of modern LLVM.

Patch by River Riddle!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276610 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 05:57:59 +00:00
Sean Silva
4cd349418b Fix : Partial Inliner requires AssumptionCacheTracker
The public InlineFunction utility assumes that the passed in
InlineFunctionInfo has a valid AssumptionCacheTracker.

Patch by River Riddle!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276609 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 05:00:00 +00:00
David Majnemer
664a7d8684 [GVNHoist] Merge metadata on hoisted instructions less conservatively
We can combine metadata from multiple instructions intelligently for
certain metadata nodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276602 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 02:21:25 +00:00
David Majnemer
304ec47e9b [GVNHoist] Properly merge alignments when hoisting
If we two loads of two different alignments, we must use the minimum of
the two alignments when hoisting.  Same deal for stores.

For allocas, use the maximum of the two allocas.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276601 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 02:21:23 +00:00
David Majnemer
2d83d8a394 [Utils] Simplify combineMetadata
Use a range-based for loop, no functional change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276600 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 02:21:19 +00:00
Elena Demikhovsky
ba55955caa [Loop Vectorizer] Handling loops FP induction variables.
Allowed loop vectorization with secondary FP IVs. Like this:
float *A;
float x = init;
for (int i=0; i < N; ++i) {
  A[i] = x;
  x -= fp_inc;
}

The auto-vectorization is possible when the induction binary operator is "fast" or the function has "unsafe" attribute.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276554 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 07:24:54 +00:00
George Burgess IV
21c0ab87c5 [MSSA] Make EXPENSIVE_CHECKS check more.
checkClobberSanity will now be run for all results of `ClobberWalk`,
instead of just the crazy phi-optimized ones. This can help us catch
cases where our cache is being wonky.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276553 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 07:03:49 +00:00
George Burgess IV
946f2aebd3 [MSSA] Remove useless assert. NFC.
liveOnEntry is always a MemoryDef; asserting that a MemoryPhi isn't
liveOnEntry, while correct, isn't very helpful. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276542 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 01:50:07 +00:00
Sanjay Patel
6928c3c35e [InstCombine] allow icmp (bit-manipulation-intrinsic(), C) folds for vectors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276523 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-23 13:06:49 +00:00
Xinliang David Li
52e0b0d91b [Profile] Use explicit flag to enable IR PGO
Patch by Jake VanAdrighem

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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276516 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-23 04:28:52 +00:00
Sean Silva
9486968c02 Avoid using a raw AssumptionCacheTracker in various inliner functions.
This unblocks the new PM part of River's patch in
https://reviews.llvm.org/D22706

Conveniently, this same change was needed for D21921 and so these
changes are just spun out from there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276515 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-23 04:22:50 +00:00
Sanjay Patel
f03395de02 [InstCombine] move udiv+cmp fold over with other BinOp+cmp folds; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276502 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-23 00:28:39 +00:00
Adam Nemet
3f4fdc9fbf [LoopDataPrefetch] Fix unused variable in release build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276491 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 23:08:10 +00:00
Adam Nemet
5781107c29 [LoopDataPrefetch] Include hotness of region in opt remark
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276488 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 22:53:17 +00:00
Adam Nemet
4758a258a9 [LoopDataPrefetch] Sort headers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276487 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 22:53:12 +00:00
Vitaly Buka
ecefac9053 Unpoison stack before resume instruction
Summary:
Clang inserts cleanup code before resume similar way as before return instruction.
This makes asan poison local variables causing false use-after-scope reports.

__asan_handle_no_return does not help here as it was executed before
llvm.lifetime.end inserted into resume block.

To avoid false report we need to unpoison stack for resume same way as for return.

PR27453

Reviewers: kcc, eugenis

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276480 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 22:04:38 +00:00
Alina Sbirlea
9909951848 Add flag to PassManagerBuilder to disable GVN Hoist Pass.
Summary:
Adding a flag to diable GVN Hoisting by default.
Note: The GVN Hoist Pass causes some Halide tests to hang. Halide will disable the pass while investigating.

Reviewers: llvm-commits, chandlerc, spop, dberlin

Subscribers: mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276479 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 22:02:19 +00:00
Michael Kuperstein
e5b8fbc43a [SLPVectorizer] Vectorize reverse-order loads in horizontal reductions
When vectorizing a tree rooted at a store bundle, we currently try to sort the
stores before building the tree, so that the stores can be vectorized. For other
trees, the order of the root bundle - which determines the order of all other
bundles - is arbitrary. That is bad, since if a leaf bundle of consecutive loads
happens to appear in the wrong order, we will not vectorize it.

This is partially mitigated when the root is a binary operator, by trying to
build a "reversed" tree when that's considered profitable. This patch extends the
workaround we have for binops to trees rooted in a horizontal reduction.

This fixes PR28474.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276477 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 21:28:48 +00:00
Jun Bum Lim
0618303382 Recommit - [DSE]Enhance shorthening MemIntrinsic based on OverlapIntervals
Recommiting r275571 after fixing crash reported in PR28270.
Now we erase elements of IOL in deleteDeadInstruction().

Original Summary:
This change use the overlap interval map built from partial overwrite tracking to perform shortening MemIntrinsics.
Add test cases which was missing opportunities before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276452 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 18:27:24 +00:00
Wei Mi
a6c7a032fe [PM] Port BreakCriticalEdges to the new PM.
Differential Revision: https://reviews.llvm.org/D22688


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276449 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 18:04:25 +00:00
David Majnemer
14834723b0 Don't remove side effecting instructions due to ConstantFoldInstruction
Just because we can constant fold the result of an instruction does not
imply that we can delete the instruction.  It may have side effects.

This fixes PR28655.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276389 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 04:54:44 +00:00
Xinliang David Li
9fb35fc1cc Sync up InstrProfData.inc with compiler-rt with fixes to references
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276388 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 04:46:56 +00:00
Vitaly Buka
cb5c574105 Fix detection of stack-use-after scope for char arrays.
Summary:
Clang inserts GetElementPtrInst so findAllocaForValue was not
able to find allocas.

PR27453

Reviewers: kcc, eugenis

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276374 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 00:56:17 +00:00
Sanjoy Das
304682fc9c [IRCE] Add an option to skip profitability checks
If `-irce-skip-profitability-checks` is passed in, IRCE will kick in in
all cases where it is legal for it to kick in.  This flag is intended to
help diagnose and analyse performance issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276372 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 00:40:56 +00:00
Sebastian Pop
09d947ac61 GVN-hoist: move check before mutating the IR
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276368 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 00:07:01 +00:00
Sebastian Pop
96c53f4696 GVN-hoist: add missing check for all GEP operands available
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276364 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 23:32:39 +00:00
Sanjay Patel
ff2ae48761 [InstCombine] break up foldICmpEqualityWithConstant(); NFCI
Almost all of these folds require changes to allow vector types. 
Splitting up the logic should make that easier to do incrementally.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276360 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 23:27:36 +00:00
Sebastian Pop
0eeda09fc4 GVH-hoist: only clone GEPs (PR28606)
Do not clone stored values unless they are GEPs that are special cased to avoid
hoisting them without hoisting their associated ld/st.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276358 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 23:22:10 +00:00
Xinliang David Li
5a06a46a4f [Profile] deprecate __llvm_profile_override_default_filename
This eliminates unncessary calls and init functions.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276354 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 23:19:10 +00:00
Wei Mi
3a4fa31d34 [PM] Port NaryReassociate to the new PM
Differential Revision: https://reviews.llvm.org/D22648


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276349 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 22:28:52 +00:00
Adam Nemet
4d4b609de8 [OptDiag,LDist] Convert remaining opt remarks to use the new API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276340 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 21:21:34 +00:00
Matthew Simpson
0414f48742 [LV] Move vector int induction update to end of latch
This patch moves the update instruction for vectorized integer induction phi
nodes to the end of the latch block. This ensures consistent placement of all
induction updates across all the kinds of int inductions we create (scalar,
splat vector, or vector phi).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276339 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 21:20:15 +00:00