8860 Commits

Author SHA1 Message Date
Chandler Carruth
112030e33e [PM/LoopUnswitch] Add back a successor set that was removed based on
code review.

It turns out this *is* necessary, and I read the comment on the API
correctly the first time. ;]

The `applyUpdates` routine requires that updates are "balanced". This is
in order to cleanly handle cycles like inserting, removing, nad then
re-inserting the same edge. This precludes inserting the same edge
multiple times in a row as handling that would cause the insertion logic
to become *ordered* instead of *unordered* (which is what the API
provides).

It happens that in this specific case nothing (other than an assert and
contract violation) goes wrong because we're never inserting and
removing the same edge. The implementation *happens* to do the right
thing to eliminate redundant insertions in that case.

But the requirement is there and there is an assert to catch it.
Somehow, after the code review I never did another asserts-clang build
testing loop-unswich for a long time. As a consequence, I didn't notice
this despite a bunch of testing going on, but it shows up immediately
with an asserts build of clang itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331246 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-01 09:42:09 +00:00
Nico Weber
0f38c60baf IWYU for llvm-config.h in llvm, additions.
See r331124 for how I made a list of files missing the include.
I then ran this Python script:

    for f in open('filelist.txt'):
        f = f.strip()
        fl = open(f).readlines()

        found = False
        for i in xrange(len(fl)):
            p = '#include "llvm/'
            if not fl[i].startswith(p):
                continue
            if fl[i][len(p):] > 'Config':
                fl.insert(i, '#include "llvm/Config/llvm-config.h"\n')
                found = True
                break
        if not found:
            print 'not found', f
        else:
            open(f, 'w').write(''.join(fl))

and then looked through everything with `svn diff | diffstat -l | xargs -n 1000 gvim -p`
and tried to fix include ordering and whatnot.

No intended behavior change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331184 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-30 14:59:11 +00:00
Philip Reames
72a0048d96 [LoopGuardWidening] Make PostDomTree optional
The effect of doing so is not disrupting the LoopPassManager when mixing this pass with other loop passes.  This should help locality of access substaintially and avoids the cost of computing PostDom.

The assumption here is that the full GuardWidening (which does use PostDom) is run as a canonicalization before loop opts and that this version is just catching cases exposed by other loop passes.  (i.e. LoopPredication, IndVarSimplify, LoopUnswitch, etc..)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331094 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-27 23:15:56 +00:00
Philip Reames
b151c0a66a [LICM] Reduce nesting with an early return [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331080 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-27 20:58:30 +00:00
Philip Reames
38e21b14cb [GuardWidening] Add some clarifying comments about heuristics [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331061 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-27 17:41:37 +00:00
Philip Reames
7b01858763 [LoopGuardWidening] Split out a loop pass version of GuardWidening
The idea is to have a pass which performs the same transformation as GuardWidening, but can be run within a loop pass manager without disrupting the pass manager structure.  As demonstrated by the test case, this doesn't quite get there because of issues with post dom, but it gives a good step in the right direction.  the motivation is purely to reduce compile time since we can now preserve locality during the loop walk.

This patch only includes a legacy pass.  A follow up will add a new style pass as well.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331060 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-27 17:29:10 +00:00
Florian Hahn
05bf903bd8 [LoopInterchange] Allow some loops with PHI nodes in the exit block.
We currently support LCSSA PHI nodes in the outer loop exit, if their
incoming values do not come from the outer loop latch or if the
outer loop latch has a single predecessor. In that case, the outer loop latch
will be executed only if the inner loop gets executed. If we have multiple
predecessors for the outer loop latch, it may be executed even if the inner
loop does not get executed.

This is a first step to support the case described in
https://bugs.llvm.org/show_bug.cgi?id=30472

Reviewers: efriedma, karthikthecool, mcrosier

Reviewed By: efriedma

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331037 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-27 13:52:51 +00:00
Florian Hahn
d2276970d8 [LoopInterchange] Ignore debug intrinsics during legality checks.
Reviewers: aprantl, mcrosier, karthikthecool

Reviewed By: aprantl

Subscribers: mattd, vsk, #debug-info, llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330931 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-26 10:26:17 +00:00
Florian Hahn
7fa40771cd [LoopInterchange] Use getExitBlock()/getExitingBlock instead of manual impl.
This also means we have to check if the latch is the exiting block now,
as `transform` expects the latches to be the exiting blocks too.

https://bugs.llvm.org/show_bug.cgi?id=36586

Reviewers: efriedma, davide, karthikthecool

Reviewed By: efriedma

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330806 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-25 09:35:54 +00:00
Bjorn Pettersson
925ebe7327 [DebugInfo] Invalidate debug info in ReassociatePass::RewriteExprTree
Summary:
When Reassociate is rewriting an expression tree it may
reuse old binary expression nodes, for new expressions.
Whenever an expression node is reused, but with a non-trivial
change in the result, we need to invalidate any debug info
that is associated with the node.

If for example rewriting
  x = mul a, b
  y = mul c, x
into
  x = mul c, b
  y = mul a, x
we still get the same result for 'y', but 'x' is a new expression.
All debug info referring to 'x' must be invalidated (marked as
optimized out) since we no longer calculate the expected value.

As a side-effect this patch avoid (at least some) problems where
reassociate could end up creating IR with debug-use before def.
Earlier the dbg.value nodes where left untouched in the IR, while
the reused binary nodes where sinked to just before the root node
of the rewritten expression tree. See PR27273 for more info about
such problems.

Reviewers: dblaikie, aprantl, dexonsmith

Reviewed By: aprantl

Subscribers: JDevlieghere, llvm-commits

Tags: #debug-info

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330804 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-25 09:23:56 +00:00
Geoff Berry
b99fab9a2a [DivRemPairs] Fix non-determinism in use list order.
Summary:
Use a MapVector instead of a DenseMap for RemMap since it is iteratated
over and the order of iteration can effect the order that new
instructions are created.  This can in turn effect the use list order of
div/rem input values if multiple new instructions are created that share
any input values.

Reviewers: spatel

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330792 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-25 02:17:56 +00:00
Chandler Carruth
685477eba1 [PM/LoopUnswitch] Begin teaching SimpleLoopUnswitch to use the new
update API for dominators rather than doing manual, hacky updates.

This is just the first step, but in some ways the most important as it
moves the non-trivial unswitching to update the domtree rather than
fully recalculating it each time.

Subsequent patches should remove the custom update logic used by the
trivial unswitch and replace it with uses of the update API.

This also fixes a number of bugs I was seeing when testing non-trivial
unswitch due to it querying the quasi-correct dominator tree. Now the
tree is 100% correct and safe to query. That said, there are still more
bugs I can see with non-trivial unswitch just running over the test
suite, so more bugfix patches are needed as well.

Thanks to both Sanjoy and Fedor for reviews and testing!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330787 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-25 00:18:07 +00:00
Florian Hahn
5e83467a58 [LoopInterchange] Make isProfitableForVectorization slightly more conservative.
After D43236, we started interchanging loops with empty dependence
matrices.  In isProfitableForVectorization, we try to determine if
interchanging makes the loop dependences more friendly to the
vectorizer. If there are no dependences, we should not interchange,
based on that heuristic.

Reviewers: efriedma, mcrosier, karthikthecool, blitz.opensource

Reviewed By: mcrosier

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330738 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-24 16:55:32 +00:00
David Blaikie
b99e72106a Fix some layering in AggressiveInstCombine (avoiding inclusion of Scalar.h)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330726 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-24 15:40:07 +00:00
Chandler Carruth
fef8b01d9b [PM/LoopUnswitch] Fix a bug in the loop block set formation of the new
loop unswitch.

This code incorrectly added the header to the loop block set early. As
a consequence we would incorrectly conclude that a nested loop body had
already been visited when the header of the outer loop was the preheader
of the nested loop. In retrospect, adding the header eagerly doesn't
really make sense. It seems nicer to let the cycle be formed naturally.
This will catch crazy bugs in the CFG reconstruction where we can't
correctly form the cycle earlier rather than later, and makes the rest
of the logic just fall out.

I've also added various asserts that make these issues *much* easier to
debug.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330707 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-24 10:33:08 +00:00
Chandler Carruth
eceadea770 [PM/LoopUnswitch] Remove another over-aggressive assert.
This code path can very clearly be called in a context where we have
baselined all the cloned blocks to a particular loop and are trying to
handle nested subloops. There is no harm in this, so just relax the
assert. I've added a test case that will make sure we actually exercise
this code path.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330680 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-24 03:27:00 +00:00
David Blaikie
b5b7fce64c InstCombine: Fix layering by not including Scalar.h in InstCombine
(notionally Scalar.h is part of libLLVMScalarOpts, so it shouldn't be
included by InstCombine which doesn't/shouldn't need to depend on
ScalarOpts)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330669 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-24 00:48:59 +00:00
Craig Topper
f7d7c68c75 [AggressiveInstCombine] Add aggressive inst combiner to the LLVM C API.
I just tried to copy what was done for regular InstCombine. Hopefully I didn't miss anything.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330668 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-24 00:39:29 +00:00
Florian Hahn
99abef011d [LoopInterchange] Do not change LI for BBs in child loops.
If a loop with child loops becomes our new inner loop after
interchanging, we only need to update LoopInfo for the blocks defined in
the old outer loop. BBs in child loops will stay there.

Reviewers: efriedma, karthikthecool, mcrosier

Reviewed By: efriedma

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330653 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23 21:38:19 +00:00
Xin Tong
7f02d6427a [CallSiteSplit] Make sure we remove nonnull if the parameter turns out to be a constant.
Summary: We do not need nonull attribute if we know an argument is going to be constant.

Reviewers: junbuml, davide, fhahn

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330641 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23 20:09:08 +00:00
Bjorn Pettersson
dee6650968 [MemCpyOpt] Skip optimizing basic blocks not reachable from entry
Summary:
Skip basic blocks not reachable from the entry node
in MemCpyOptPass::iterateOnFunction.

Code that is unreachable may have properties that do not exist
for reachable code (an instruction in a basic block can for
example be dominated by a later instruction in the same basic
block, for example if there is a single block loop).
MemCpyOptPass::processStore is only safe to use for reachable
basic blocks, since it may iterate past the basic block
beginning when used for unreachable blocks. By simply skipping
to optimize unreachable basic blocks we can avoid asserts such
as "Assertion `!NodePtr->isKnownSentinel()' failed."
in MemCpyOptPass::processStore.

The problem was detected by fuzz tests.

Reviewers: eli.friedman, dneilson, efriedma

Reviewed By: efriedma

Subscribers: efriedma, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330635 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23 19:55:04 +00:00
Daniel Neilson
6c92ba3e0b [DSE] Teach the pass that atomic memory intrinsics are stores.
Summary:
This change teaches DSE that the atomic memory intrinsics are stores
that can be eliminated, and can allow other stores to be eliminated.
This change specifically does not teach DSE that these intrinsics
can be partially eliminated (i.e. length reduced, and dest/src changed);
that will be handled in another change.

Reviewers: mkazantsev, skatkov, apilipenko, efriedma, rsmith

Reviewed By: efriedma

Subscribers: dmgreen, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330629 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23 19:06:49 +00:00
Chandler Carruth
a9104c62a0 [PM/LoopUnswitch] Remove a buggy assert in the new loop unswitch.
The condition this was asserting doesn't actually hold. I've added
comments to explain why, removed the assert, and added a fun test case
reduced out of 403.gcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330564 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23 06:58:36 +00:00
Chandler Carruth
57b516a175 [PM/LoopUnswitch] Fix comment typo. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330560 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23 00:48:42 +00:00
Michael Zolotukhin
b2249a973b Revert r330431.
There are still stage3/stage4 miscompares :(

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330446 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-20 16:57:10 +00:00
Florian Hahn
73d8c2e5e3 [NewGVN] Split OpPHI detection and creation.
It also adds a check making sure PHIs for operands are all in the same
block.

Patch by Daniel Berlin <dberlin@dberlin.org>

Reviewers: dberlin, davide

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330444 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-20 16:37:13 +00:00
Michael Zolotukhin
1efc1f1838 Revert "Revert r330403 and r330413."
Reapply the patches with a fix. Thanks Ilya and Hans for the reproducer!
This reverts commit r330416.

The issue was that removing predecessors invalidated uses that we stored
for rewrite. The fix is to finish manipulating with CFG before we select
uses for rewrite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330431 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-20 13:34:32 +00:00
Ilya Biryukov
8e71a936a4 Revert r330403 and r330413.
Revert r330413: "[SSAUpdaterBulk] Use SmallVector instead of DenseMap for storing rewrites."
Revert r330403 "Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time."

r330403 commit seems to crash clang during our integrate while doing PGO build with the following stacktrace:
      #2 llvm::SSAUpdaterBulk::RewriteAllUses(llvm::DominatorTree*, llvm::SmallVectorImpl<llvm::PHINode*>*)
      #3 llvm::JumpThreadingPass::ThreadEdge(llvm::BasicBlock*, llvm::SmallVectorImpl<llvm::BasicBlock*> const&, llvm::BasicBlock*)
      #4 llvm::JumpThreadingPass::ProcessThreadableEdges(llvm::Value*, llvm::BasicBlock*, llvm::jumpthreading::ConstantPreference, llvm::Instruction*)
      #5 llvm::JumpThreadingPass::ProcessBlock(llvm::BasicBlock*)
The crash happens while compiling 'lib/Analysis/CallGraph.cpp'.

r3340413 is reverted due to conflicting changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330416 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-20 10:52:54 +00:00
Michael Zolotukhin
35a415fc01 [SSAUpdaterBulk] Use SmallVector instead of DenseMap for storing rewrites.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330413 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-20 10:31:06 +00:00
Michael Zolotukhin
caacf23982 Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time.
Hopefully, changing set to vector removes nondeterminism detected by
some bots, or the new assert will catch something.

This reverts commit r330180.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330403 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-20 08:01:08 +00:00
Jin Lin
a5747ee16d Refine the loop rotation's API
Summary:
The following changes addresses the following two issues.

1) The existing loop rotation pass contains both loop latch simplification and loop rotation. So one flag RotationOnly is added to be passed to the loop rotation pass.
2) The threshold value is initialized with MAX_UINT since the loop rotation utility should not have threshold limit.

Reviewers: dmgreen, efriedma

Reviewed By: efriedma

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330362 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-19 20:29:43 +00:00
Chandler Carruth
6ff81c8a68 [PM/LoopUnswitch] Detect irreducible control flow within loops and skip unswitching non-trivial edges.
Summary:
This fixes the bug pointed out in review with non-trivial unswitching.

This also provides a basis that should make it pretty easy to finish
fleshing out a routine to scan an entire function body for irreducible
control flow, but this patch remains minimal for disabling loop
unswitch.

Reviewers: sanjoy, fedor.sergeev

Subscribers: mcrosier, hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330357 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-19 18:44:25 +00:00
Sanjay Patel
4d445a2a38 [Reassociate] fix formatting; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330348 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-19 17:56:36 +00:00
Florian Hahn
141e6bde5c [NewGVN] Add ops as dependency if we cannot find a leader for ValueOp.
If those operands change, we might find a leader for ValueOp, which
could enable new phi-of-op creation.

This fixes a case where we missed creating a phi-of-ops node. With D43865
and this patch, bootstrapping clang/llvm works with -enable-newgvn, whereas
without it, the "value changed after iteration" assertion is triggered.

Reviewers: dberlin, davide

Reviewed By: dberlin

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330334 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-19 15:05:47 +00:00
Sam Parker
2acef23b4c [IRCE] Only check for NSW on equality predicates
After investigation discussed in D45439, it would seem that the nsw
flag restriction is unnecessary in most cases. So the IsInductionVar
lambda has been removed, the functionality extracted, and now only
require nsw when using eq/ne predicates.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330256 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-18 13:50:28 +00:00
Michael Zolotukhin
f7a516d335 Revert "Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." again."
This reverts r330175. There are still stage3/stage4 miscompares.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330180 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-17 07:31:27 +00:00
Michael Zolotukhin
11001a689d Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." again.
One more, hopefully the last, bug is fixed: when forming UsesToRewrite
we should ignore phi operands coming from edges that we want to delete.

This reverts r329910.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330175 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-17 04:45:22 +00:00
Roman Lebedev
65f2d885f0 [NFC] ConstantOffsetExtractor::CanTraceInto(): add FIXME: no tests
As suggested in https://reviews.llvm.org/D45631#1068338,
looking at haveNoCommonBitsSet() users, and *trying* to
show the change effect elsewhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330100 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-15 18:59:27 +00:00
Hiroshi Inoue
c4c17fac46 [NFC] fix trivial typos in document and comments
"not not" -> "not" etc



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330083 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-14 08:59:00 +00:00
Mandeep Singh Grang
15ff8cad10 [Transforms] Change std::sort to llvm::sort in response to r327219
Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: kcc, pcc, danielcdh, jmolloy, sanjoy, dberlin, ruiu

Reviewed By: ruiu

Subscribers: ruiu, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330059 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13 19:47:57 +00:00
Xin Tong
bed2fc33e0 [CallSiteSplit] Fix comment. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329987 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13 04:35:38 +00:00
Benjamin Kramer
9ef860a398 Revert "Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time."
This reverts commit r329865. Causes stage2/stage3 miscompare.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329910 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-12 13:52:02 +00:00
Sam Parker
f09f1560b1 [IRCE] isKnownNonNegative helper function
Created a helper function to query for non negative SCEVs. Uses the
SGE predicate to catch constants that could be interpreted as
negative.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329907 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-12 12:49:40 +00:00
Hiroshi Inoue
ef1bc2d3ca [NFC] fix trivial typos in documents and comments
"is is" -> "is", "if if" -> "if", "or or" -> "or"



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329878 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-12 05:53:20 +00:00
Michael Zolotukhin
b33a02496a Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time.
This reapplies commit r329644.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329865 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-11 23:37:53 +00:00
Sanjay Patel
2732c9eec9 [CVP] simplify phi with constant incoming values that match common variable edge values
This is based on an example that was recently posted on llvm-dev:

void *propagate_null(void* b, int* g) {
  if (!b) {
    return 0;
  }
  (*g)++;
  return b;
}

https://godbolt.org/g/xYk3qG

The original code or constant propagation in other passes has obscured the fact 
that the phi can be removed completely.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329755 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-10 20:42:39 +00:00
Michael Zolotukhin
4be25bd837 Revert "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time.
This reverts r329661. Bots are still unhappy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329666 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-10 03:40:29 +00:00
Michael Zolotukhin
134d36e085 Revert "Revert "[PR16756] Use SSAUpdaterBulk in JumpThreading.""
This reapplies commit r329644.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329661 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-10 02:16:45 +00:00
Michael Zolotukhin
af04f87166 Revert "[PR16756] Use SSAUpdaterBulk in JumpThreading."
This reverts commit r329644.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329650 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-10 00:42:43 +00:00
Michael Zolotukhin
79081b466d [PR16756] Use SSAUpdaterBulk in JumpThreading.
Summary:
SSAUpdater is a bottleneck in JumpThreading, and this patch improves the
situation by using SSAUpdaterBulk instead.

Compile time impact: no noticable changes on CTMark, a big improvement
on the test from PR16756.

Reviewers: dberlin, davide, MatzeB

Subscribers: llvm-commits, hiraditya

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329644 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-09 23:37:37 +00:00