16564 Commits

Author SHA1 Message Date
Haicheng Wu
ede1dc8ce8 [LoopUnroll] Move code to exit early. NFC.
Just to save some compilation time.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287800 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 19:39:26 +00:00
Chandler Carruth
33d568124e [PM] Change the static object whose address is used to uniquely identify
analyses to have a common type which is enforced rather than using
a char object and a `void *` type when used as an identifier.

This has a number of advantages. First, it at least helps some of the
confusion raised in Justin Lebar's code review of why `void *` was being
used everywhere by having a stronger type that connects to documentation
about this.

However, perhaps more importantly, it addresses a serious issue where
the alignment of these pointer-like identifiers was unknown. This made
it hard to use them in pointer-like data structures. We were already
dodging this in dangerous ways to create the "all analyses" entry. In
a subsequent patch I attempted to use these with TinyPtrVector and
things fell apart in a very bad way.

And it isn't just a compile time or type system issue. Worse than that,
the actual alignment of these pointer-like opaque identifiers wasn't
guaranteed to be a useful alignment as they were just characters.

This change introduces a type to use as the "key" object whose address
forms the opaque identifier. This both forces the objects to have proper
alignment, and provides type checking that we get it right everywhere.
It also makes the types somewhat less mysterious than `void *`.

We could go one step further and introduce a truly opaque pointer-like
type to return from the `ID()` static function rather than returning
`AnalysisKey *`, but that didn't seem to be a clear win so this is just
the initial change to get to a reliably typed and aligned object serving
is a key for all the analyses.

Thanks to Richard Smith and Justin Lebar for helping pick plausible
names and avoid making this refactoring many times. =] And thanks to
Sean for the super fast review!

While here, I've tried to move away from the "PassID" nomenclature
entirely as it wasn't really helping and is overloaded with old pass
manager constructs. Now we have IDs for analyses, and key objects whose
address can be used as IDs. Where possible and clear I've shortened this
to just "ID". In a few places I kept "AnalysisID" to make it clear what
was being identified.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287783 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 17:53:26 +00:00
Alina Sbirlea
106bcf1838 [LoadStoreVectorizer] Enable vectorization of stores in the presence of an aliasing load
Summary:
The "getVectorizablePrefix" method would give up if it found an aliasing load for a store chain.
In practice, the aliasing load can be treated as a memory barrier and all stores that precede it
are a valid vectorizable prefix.
Issue found by volkan in D26962. Testcase is a pruned version of the one in the original patch.

Reviewers: jlebar, arsenm, tstellarAMD

Subscribers: mzolotukhin, wdng, nhaehnle, anna, volkan, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287781 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 17:43:15 +00:00
Justin Lebar
65342d216d [StructurizeCFG] Refactor OrderNodes.
Summary:
No need to copy the RPOT vector before using it.  Switch from std::map
to SmallDenseMap.  Get rid of an unused variable (TempVisited).  Get rid
of a typedef, RNVector, which is now used only once.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287721 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 23:14:11 +00:00
Justin Lebar
9e95f26cb5 [StructurizeCFG] Add whitespace in getAnalysisUsage.
Summary:
"addRequired" and "addPreserved" look very similar when squished up next
to each other -- without the newline this code looked to me like it was
addRequired'ing DominatorTreeWrapperPass twice.

Reviewers: arsenm

Subscribers: wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287720 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 23:14:07 +00:00
Justin Lebar
31a97838f9 [StructurizeCFG] Remove unnecessary "using" in class.
Reviewers: arsenm

Subscribers: wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287719 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 23:13:49 +00:00
Justin Lebar
7532ceb728 [StructurizeCFG] Merge the two constructors into one.
Reviewers: arsenm

Subscribers: wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287718 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 23:13:44 +00:00
Justin Lebar
9582fba0c0 [StructurizeCFG] Use a for-each loop instead of iterators in runOnRegion.
Summary:

Reviewers: arsenm

Subscribers: wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287717 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 23:13:37 +00:00
Justin Lebar
a9c2819951 [StructurizeCFG] Make hasOnlyUniformBranches a non-member function.
Summary: Lets us get rid of one member variable too.

Reviewers: arsenm

Subscribers: wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287716 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 23:13:33 +00:00
Sanjay Patel
68d10b6699 add and use isBitwiseLogicOp() helper function; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287712 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 22:54:36 +00:00
Dehao Chen
ded77cc923 Before sample pgo annotation, do not inline a function that has no debug info. (NFC)
If there is no debug info in the callee, inlining it will not help annotator. This avoids infinite loop as reported in PR/31119.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287710 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 22:50:01 +00:00
Davide Italiano
4f65080637 [SCCP] Remove code in visitBinaryOperator (and add tests).
We visit and/or, we try to derive a lattice value for the
instruction even if one of the operands is overdefined.
If the non-overdefined value is still 'unknown' just return and wait
for ResolvedUndefsIn to "plug in" the correct value. This simplifies
the logic a bit. While I'm here add tests for missing cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287709 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 22:11:25 +00:00
Sanjay Patel
fe998e6ec2 [InstCombine] change bitwise logic type to eliminate bitcasts
In PR27925:
https://llvm.org/bugs/show_bug.cgi?id=27925

...we proposed adding this fold to eliminate a bitcast. In D20774, there was 
some concern about changing the type of a bitwise op as well as creating 
bitcasts that might not be free for a target. However, if we're strictly 
eliminating an instruction (by limiting this to one-use ops), then we should 
be able to do this in InstCombine.

But we're cautiously restricting the transform for now to vector types to
avoid possible backend problems. A transform to make sure the logic op is
legal for the target should be added to reverse this transform and improve
codegen.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287707 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 22:05:48 +00:00
Vyacheslav Klochkov
f907632b35 Fixed the lost FastMathFlags in GVN(Global Value Numbering).
Reviewer: Hal Finkel.
Differential Revision: https://reviews.llvm.org/D26952



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287700 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 20:52:53 +00:00
Vyacheslav Klochkov
f060e3f4bc Fixed the lost FastMathFlags in Reassociate optimization.
Reviewer: Hal Finkel.
Differential Revision: https://reviews.llvm.org/D26957



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287695 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 20:23:04 +00:00
Eli Friedman
1e10f377b2 [LoopReroll] Make root-finding more aggressive.
Allow using an instruction other than a mul or phi as the base for
root-finding. For example, the included testcase includes a loop
which requires using a getelementptr as the base for root-finding.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287588 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 22:35:34 +00:00
Sanjay Patel
fea0530bd5 [InstCombine] canonicalize min/max constant to select's false value
This is a first step towards canonicalization and improved folding/codegen
for integer min/max as discussed here:
http://lists.llvm.org/pipermail/llvm-dev/2016-November/106868.html

Here, we're just matching the simplest min/max patterns and adjusting the
icmp predicate while swapping the select operands.

I've included FIXME tests in test/Transforms/InstCombine/select_meta.ll
so it's easier to see how this might be extended (corresponds to the TODO
comment in the code). That's also why I'm using matchSelectPattern()
rather than a simpler check; once the backend is patched, we can just 
remove some of the restrictions to allow the obfuscated min/max patterns
in the FIXME tests to be matched.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287585 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 22:04:14 +00:00
Evgeny Stupachenko
150a3cafdd LSR debug fix.
Summary:
Dump instruction instead of address.
Reviewers: hfinkel

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

From: Evgeny Stupachenko <evstupac@gmail.com>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287584 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 21:55:03 +00:00
Sanjay Patel
52b86bf6c0 fix formatting; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287582 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 21:48:36 +00:00
Reid Kleckner
131962dc53 [asan] Make ASan compatible with linker dead stripping on Windows
Summary:
This is similar to what was done for Darwin in rL264645 /
http://reviews.llvm.org/D16737, but it uses COFF COMDATs to achive the
same result instead of relying on new custom linker features.

As on MachO, this creates one metadata global per instrumented global.
The metadata global is placed in the custom .ASAN$GL section, which the
ASan runtime will iterate over during initialization. There are no other
references to the metadata, so normal linker dead stripping would
discard it. However, the metadata is put in a COMDAT group with the
instrumented global, so that it will be discarded if and only if the
instrumented global is discarded.

I didn't update the ASan ABI version check since this doesn't affect
non-Windows platforms, and the WinASan ABI isn't really stable yet.

Implementing this for ELF will require extending LLVM IR and MC a bit so
that we can use non-COMDAT section groups.

Reviewers: pcc, kcc, mehdi_amini, kubabrecka

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287576 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 20:40:37 +00:00
Mandeep Singh Grang
d8c5ecbd82 [MemorySSA] Fix for non-determinism in codegen
This patch fixes the non-determinism caused due to iterating SmallPtrSet's
which was uncovered due to the experimental "reverse iteration order " patch:
https://reviews.llvm.org/D26718

The following unit tests failed because of the undefined order of iteration.
LLVM :: Transforms/Util/MemorySSA/cyclicphi.ll
LLVM :: Transforms/Util/MemorySSA/many-dom-backedge.ll
LLVM :: Transforms/Util/MemorySSA/many-doms.ll
LLVM :: Transforms/Util/MemorySSA/phi-translation.ll

Reviewers: dberlin, mgrang

Subscribers: dberlin, llvm-commits, david2050

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287563 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 19:33:02 +00:00
Marcin Koscielnicki
f14d6e1651 [InstrProfiling] Mark __llvm_profile_instrument_target last parameter as i32 zeroext if appropriate.
On some architectures (s390x, ppc64, sparc64, mips), C-level int is passed
as i32 signext instead of plain i32.  Likewise, unsigned int may be passed
as i32, i32 signext, or i32 zeroext depending on the platform.  Mark
__llvm_profile_instrument_target properly (its last parameter is unsigned
int).

This (together with the clang change) makes compiler-rt profile testsuite pass
on s390x.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287534 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 11:57:19 +00:00
Davide Italiano
02ca2cb0e6 [GlobalSplit] Port to the new pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287511 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 00:28:23 +00:00
Simon Pilgrim
431da84b02 Fix spelling mistakes in Transforms comments. NFC.
Identified by Pedro Giffuni in PR27636.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287488 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-20 13:19:49 +00:00
Benjamin Kramer
c57d1d6295 Give some helper classes/functions internal linkage. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287462 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-19 20:44:26 +00:00
Michael Zolotukhin
3a7f010bf7 [LoopSimplify] Preserve LCSSA when removing edges from unreachable blocks.
This fixes PR30454.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287379 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 21:01:12 +00:00
Florian Hahn
8a56643640 [simplifycfg][loop-simplify] Preserve loop metadata in 2 transformations.
insertUniqueBackedgeBlock in lib/Transforms/Utils/LoopSimplify.cpp now
propagates existing llvm.loop metadata to newly the added backedge.

llvm::TryToSimplifyUncondBranchFromEmptyBlock in lib/Transforms/Utils/Local.cpp
now propagates existing llvm.loop metadata to the branch instructions in the
predecessor blocks of the empty block that is removed.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287341 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 13:12:07 +00:00
Craig Topper
35b775d13a [InstCombine][AVX-512] Teach InstCombineCalls how to handle the intrinsics for variable shift with 16-bit elements.
This is a straightforward extension of the existing support for 32/64-bit element types. Just needed to add the additional instrinsics to the switches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287316 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 06:04:33 +00:00
Anna Zaks
f29212fa7e [asan] Turn on Mach-O global metadata liveness tracking by default
This patch turns on the metadata liveness tracking since all known issues
have been resolved. The future has been implemented in
https://reviews.llvm.org/D16737 and enables support of dead code stripping
option on Mach-O platforms.

As part of enabling the feature, I also plan on reverting the following
patch to compiler-rt:

http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160704/369910.html

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287235 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-17 16:55:40 +00:00
Chris Bieneman
92cb3eecbd [CMake] NFC. Updating CMake dependency specifications
This patch updates a bunch of places where add_dependencies was being explicitly called to add dependencies on intrinsics_gen to instead use the DEPENDS named parameter. This cleanup is needed for a patch I'm working on to add a dependency debugging mode to the build system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287206 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-17 04:36:50 +00:00
Dehao Chen
3ecb35bc13 Use profile info to adjust loop unroll threshold.
Summary:
For flat loop, even if it is hot, it is not a good idea to unroll in runtime, thus we set a lower partial unroll threshold.
For hot loop, we set a higher unroll threshold and allows expensive tripcount computation to allow more aggressive unrolling.

Reviewers: davidxl, mzolotukhin

Subscribers: sanjoy, mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287186 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-17 01:17:02 +00:00
Peter Collingbourne
510c1b6ff7 Introduce GlobalSplit pass.
This pass splits globals into elements using inrange annotations on
getelementptr indices.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287178 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 23:40:26 +00:00
Sanjay Patel
2318eb95f5 [InstCombine] replace unreachable with assert and remove unreachable code; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287147 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 20:40:02 +00:00
Sanjay Patel
1c3c35ef97 [InstCombine] fix formatting and add FIXMEs to foldOperationIntoSelectOperand(); NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287145 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 20:18:34 +00:00
Mandeep Singh Grang
23e86b5ddf [LoopVectorize] Fix for non-determinism in codegen
Summary: This patch fixes issues in codegen uncovered due to https://reviews.llvm.org/D26718

Reviewers: mssimpso

Subscribers: llvm-commits, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287135 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 18:53:17 +00:00
Reid Kleckner
195a4bc96d [sancov] Name the global containing the main source file name
If the global name doesn't start with __sancov_gen, ASan will insert
unecessary red zones around it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287117 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 16:50:43 +00:00
Craig Topper
614df99de4 [X86] Remove the scalar intrinsics for fadd/fsub/fdiv/fmul
Summary: These intrinsics have been unused for clang for a while. This patch removes them. We auto upgrade them to extractelements, a scalar operation and then an insertelement. This matches the sequence used by clangs intrinsic file.

Reviewers: zvi, delena, RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287083 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 05:24:10 +00:00
Vyacheslav Klochkov
747716a482 Fixed the lost FastMathFlags for CALL operations in SLPVectorizer.
Reviewer: Michael Zolotukhin.
Differential Revision: https://reviews.llvm.org/D26575



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287064 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 00:55:50 +00:00
Justin Lebar
eb77a4a537 [BypassSlowDivision] Handle division by constant numerators better.
Summary:
We don't do BypassSlowDivision when the denominator is a constant, but
we do do it when the numerator is a constant.

This patch makes two related changes to BypassSlowDivision when the
numerator is a constant:

 * If the numerator is too large to fit into the bypass width, don't
   bypass slow division (because we'll never run the smaller-width
   code).

 * If we bypass slow division where the numerator is a constant, don't
   OR together the numerator and denominator when determining whether
   both operands fit within the bypass width.  We need to check only the
   denominator.

Reviewers: tra

Subscribers: llvm-commits, jholewinski

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287062 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 00:44:47 +00:00
Justin Lebar
c18d950852 [BypassSlowDivision] Simplify partially-tautological if statement.
if (A || (B && A)) --> if (A).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287061 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 00:44:43 +00:00
Filipe Cabecinhas
ce26290c52 [AddressSanitizer] Add support for (constant-)masked loads and stores.
This patch adds support for instrumenting masked loads and stores under
ASan, if they have a constant mask.

isInterestingMemoryAccess now supports returning a mask to be applied to
the loads, and instrumentMop will use it to generate additional checks.

Added tests for v4i32 v8i32, and v4p0i32 (~v4i64) for both loads and
stores (as well as a test to verify we don't add checks to non-constant
masks).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287047 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 22:37:30 +00:00
Kostya Serebryany
dd850be3cf [sanitizer-coverage] make sure asan does not instrument coverage guards (reported in https://github.com/google/oss-fuzz/issues/84)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287030 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 21:12:50 +00:00
Wei Mi
a96c2c70b0 Revert r286999 which caused buildbot test failures. Some testcases need to be made target specific.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287014 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 19:42:05 +00:00
Wei Mi
6c7170194a [LSR] Allow formula containing Reg for SCEVAddRecExpr related with outerloop.
In RateRegister of existing LSR, if a formula contains a Reg which is a SCEVAddRecExpr,
and this SCEVAddRecExpr's loop is an outerloop, the formula will be marked as Loser
and dropped.

Suppose we have an IR that %for.body is outerloop and %for.body2 is innerloop. LSR only
handle inner loop now so only %for.body2 will be handled.

Using the logic above, formula like
reg(%array) + reg({1,+, %size}<%for.body>) + 1*reg({0,+,1}<%for.body2>) will be dropped
no matter what because reg({1,+, %size}<%for.body>) is a SCEVAddRecExpr type reg related
with outerloop. Only formula like
reg(%array) + 1*reg({{1,+, %size}<%for.body>,+,1}<nuw><nsw><%for.body2>) will be kept
because the SCEVAddRecExpr related with outerloop is folded into the initial value of the
SCEVAddRecExpr related with current loop.

But in some cases, we do need to share the basic induction variable
reg{0 ,+, 1}<%for.body2> among LSR Uses to reduce the final total number of induction
variables used by LSR, so we don't want to drop the formula like
reg(%array) + reg({1,+, %size}<%for.body>) + 1*reg({0,+,1}<%for.body2>) unconditionally.

From the existing comment, it tries to avoid considering multiple level loops at the same time.
However, existing LSR only handles innermost loop, so for any SCEVAddRecExpr with a loop other
than current loop, it is an invariant and will be simple to handle, and the formula doesn't have
to be dropped.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286999 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 18:35:53 +00:00
Wei Mi
334f714ef9 [IndVars] Change the order to compute WidenAddRec in widenIVUse.
When both WidenIV::getWideRecurrence and WidenIV::getExtendedOperandRecurrence
return non-null but different WideAddRec, if getWideRecurrence is called
before getExtendedOperandRecurrence, we won't bother to call
getExtendedOperandRecurrence again. But As we know it is possible that after
SCEV folding, we cannot prove the legality using the SCEVAddRecExpr returned
by getWideRecurrence. Meanwhile if getExtendedOperandRecurrence returns non-null
WideAddRec, we know for sure that it is legal to do widening for current instruction.
So it is better to put getExtendedOperandRecurrence before getWideRecurrence, which
will increase the chance of successful widening.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286987 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 17:34:52 +00:00
Craig Topper
5c8c06592a [AVX-512] Add AVX-512 vector shift intrinsics to memory santitizer.
Just needed to add the intrinsics to the exist switch. The code is generic enough to support the wider vectors with no changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286980 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 16:27:33 +00:00
Pablo Barrio
31e986bef3 Revert "[JumpThreading] Unfold selects that depend on the same condition"
This reverts commit ac54d0066c478a09c7cd28d15d0f9ff8af984afc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286976 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 15:42:23 +00:00
Pablo Barrio
2d83e194e2 Revert "[JumpThreading] Prevent non-deterministic use lists"
This reverts commit f2c2f5354070469dac253373c66527ca971ddc66.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286975 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 15:42:17 +00:00
Robert Lougher
75d009930b [LoopVectorizer] When estimating reg usage, unused insts may "end" another use
The register usage algorithm incorrectly treats instructions whose value is
not used within the loop (e.g. those that do not produce a value).

The algorithm first calculates the usages within the loop.  It iterates over
the instructions in order, and records at which instruction index each use
ends (in fact, they're actually recorded against the next index, as this is
when we want to delete them from the open intervals).

The algorithm then iterates over the instructions again, adding each
instruction in turn to a list of open intervals.  Instructions are then
removed from the list of open intervals when they occur in the list of uses
ended at the current index.

The problem is, instructions which are not used in the loop are skipped.
However, although they aren't used, the last use of a value may have been
recorded against that instruction index.  In this case, the use is not deleted
from the open intervals, which may then bump up the estimated register usage.

This patch fixes the issue by simply moving the "is used" check after the loop
which erases the uses at the current index.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286969 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 14:27:33 +00:00
Florian Hahn
cf8930d714 Test commit, remove trailing space.
This commit is used to test commit access.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286957 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 13:28:42 +00:00