15765 Commits

Author SHA1 Message Date
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
Rong Xu
8dbdfe6cb7 [PGO] Make needsComdatForCounter() available (NFC)
Move needsComdatForCounter() to lib/ProfileData/InstrProf.cpp from
lib/Transforms/Instrumentation/InstrProfiling.cpp to make is available for
other files.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276330 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 20:50:02 +00:00
Sanjoy Das
e50f54b403 [IndVars] Reflow oddly formatted condition; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276319 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 18:58:01 +00:00
Sanjay Patel
990df03c65 make InstCombine compare helper functions private; NFC
Also, rename some of them for consistency and to follow current conventions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276312 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 18:07:40 +00:00
Vedant Kumar
12a672ec61 Avoid a string copy, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276310 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 17:50:07 +00:00
Sanjay Patel
ec559e1ab3 [InstCombine] break up visitICmpInstWithInstAndIntCst(); NFCI
Making smaller pieces out of some of these ~1000 line functions should make
it easier to incrementally upgrade them to handle vector types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276304 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 17:15:49 +00:00
Benjamin Kramer
b11b3529ce Rename StringMap::emplace_second to try_emplace.
Coincidentally this function maps to the C++17 try_emplace. Rename it
for consistentcy with C++17 std::map. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276276 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 13:37:48 +00:00
Benjamin Kramer
367e93b45c [GCOV] Remove a layer of indirection.
StringMap is designed to hold large values. No functionality change
intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276265 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 12:06:31 +00:00
David Majnemer
00101d65c2 [GVNHoist] Preserve optimization hints which agree
If we have optimization hints with agree with each other along different
paths, preserve them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276248 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 07:16:26 +00:00
David Majnemer
2839fb67f7 [GVNHoist] Don't wrongly preserve TBAA
We hoisted loads/stores without taking into account which can cause
miscompiles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276240 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 05:59:53 +00:00
David Majnemer
724a2ec18a [MergedLoadStoreMotion] Remove out of date comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276239 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 05:59:51 +00:00
Adam Nemet
42a372e9b8 [OptDiag,LV] Add hotness attribute to applied-optimization remarks
Test coverage is provided by modifying the function in the FP-math
testcase that we are allowed to vectorize.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276223 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 01:07:13 +00:00
Sanjay Patel
a2db716bbb [InstCombine] LogicOpc (zext X), C --> zext (LogicOpc X, C) (PR28476)
The benefits of this change include:
1. Remove DeMorgan-matching code that was added specifically to work-around 
   the missing transform in http://reviews.llvm.org/rL248634.
2. Makes the DeMorgan transform work for vectors too.
3. Fix PR28476: https://llvm.org/bugs/show_bug.cgi?id=28476

Extending this transform to other casts and other associative operators may
be useful too. See https://reviews.llvm.org/D22421 for a prerequisite for
doing that though.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276221 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 00:24:18 +00:00
Adam Nemet
cebe016761 [OptDiag,LV] Add hotness attribute to the derived analysis remarks
This includes FPCompute and Aliasing.

Testcase is based on no_fpmath.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276211 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 23:50:32 +00:00
Sanjay Patel
4c8b3b4588 [InstSimplify][InstCombine] don't crash when folding vector selects of icmp
Differential Revision: https://reviews.llvm.org/D22602


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276209 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 23:40:01 +00:00
George Burgess IV
6b817ea4e2 Make help text more consistent. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276205 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 23:14:29 +00:00
Adam Nemet
957976efe6 [OptDiag,LV] Add hotness attribute to analysis remarks
The earlier change added hotness attribute to missed-optimization
remarks.  This follows up with the analysis remarks (the ones explaining
the reason for the missed optimization).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276192 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 21:44:26 +00:00
David Majnemer
991d814755 [GVNHoist] Don't hoist PHI nodes
We hoisted PHIs without respecting their special insertion point in the
block, leading to verfier errors.

This fixes PR28626.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276181 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 21:05:01 +00:00
Davide Italiano
c2a8447473 [SCCP] Zap multiple return values.
We can replace the return values with undef if we replaced all
the call uses with a constant/undef.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276174 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 20:17:13 +00:00
Justin Lebar
0cd5bfadb9 [LSV] Don't move stores across may-load instrs, and loosen restrictions on moving loads.
Summary:
Previously we wouldn't move loads/stores across instructions that had
side-effects, where that was defined as may-write or may-throw.  But
this is not sufficiently restrictive: Stores can't safely be moved
across instructions that may load.

This patch also adds a DEBUG check that all instructions in our chain
are either loads or stores.

Reviewers: asbirlea

Subscribers: llvm-commits, jholewinski, arsenm, mzolotukhin

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

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