Commit Graph

13024 Commits

Author SHA1 Message Date
David Blaikie
d84c8ef1be [opaque pointer type] Explicitly store the pointee type of the result of a GEP
Alternatively, this type could be derived on-demand whenever
getResultElementType is called - if someone thinks that's the better
choice (simple time/space tradeoff), I'm happy to give it a go.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238716 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 03:09:34 +00:00
Benjamin Kramer
9589ff8949 Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.


Call sites were found with the ASTMatcher + some semi-automated cleanup.

memberCallExpr(
    argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
    on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
    hasArgument(0, bindTemporaryExpr(
                       hasType(recordDecl(hasNonTrivialDestructor())),
                       has(constructExpr()))),
    unless(isInTemplateInstantiation()))

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238602 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 19:43:39 +00:00
Wei Mi
61897e8564 Enable exitValue rewrite only when the cost of expansion is low.
The patch evaluates the expansion cost of exitValue in indVarSimplify pass, and only does the rewriting when the expansion cost is low or loop can be deleted with the rewriting. It provides an option "-replexitval=" to control the default aggressiveness of the exitvalue rewriting. It also fixes some missing cases in SCEVExpander::isHighCostExpansionHelper to enhance the evaluation of SCEV expansion cost.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238507 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 21:49:07 +00:00
David Majnemer
967f6ad3e1 [InstCombine] Fold IntToPtr and PtrToInt into preceding loads.
Currently we only fold a BitCast into a Load when the BitCast is its
only user.

Do the same for any no-op cast.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238452 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 18:39:17 +00:00
Benjamin Kramer
24bccaf9f9 Don't call utostr in Twine/raw_ostream contexts.
Creating temporary std::strings there is unnecessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238412 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 11:24:24 +00:00
Yury Gribov
bf2ac0e578 [ASan] Fix previous commit. Patch by Max Ostapenko!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238403 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 08:03:28 +00:00
Yury Gribov
08e5ec43f4 [ASan] New approach to dynamic allocas unpoisoning. Patch by Max Ostapenko!
Differential Revision: http://reviews.llvm.org/D7098


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238402 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 07:51:49 +00:00
David Majnemer
48e2671cb6 [Reassociate] Canonicalizing 'x [+-] (-Constant * y)' isn't always a win
Canonicalizing 'x [+-] (-Constant * y)' is not a win if we don't *know*
we will open up CSE opportunities.

If the multiply was 'nsw', then negating 'y' requires us to clear the
'nsw' flag.  If this is actually worth pursuing, it is probably more
appropriate to do so in GVN or EarlyCSE.

This fixes PR23675.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238397 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 06:16:39 +00:00
Jingyue Wu
4977e92629 [NaryReassociate] Run EarlyCSE after NaryReassociate
Summary:
This patch made two improvements to NaryReassociate and the NVPTX pipeline

1. Run EarlyCSE/GVN after NaryReassociate to get rid of redundant common
expressions.

2. When adding an instruction to SeenExprs, maps both the SCEV before and after
reassociation to that instruction.

Test Plan: updated @reassociate_gep_nsw in nary-gep.ll

Reviewers: meheff, broune

Reviewed By: broune

Subscribers: dberlin, jholewinski, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238396 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 04:56:52 +00:00
Diego Novillo
b72f3e0d32 Final fix for PR 23499 and IR test case.
This fixes a bit I forgot in r238335. In addition to the data record and
the counter, we can also move the name of the counter to the comdat for
the associated function.

I'm also adding an IR test case to check that these three elements are
placed in the proper comdat.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238351 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 19:34:01 +00:00
Diego Novillo
df65fd3205 Fix PR 23499 - Avoid multiple profile counters for functions in comdat sections.
Counter symbols created for linkonce functions are not discarded by ELF
linkers unless the symbols are placed in the same comdat section as its
associated function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238335 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 16:44:47 +00:00
Philip Reames
90b5eb2319 [PlaceSafepoints] Entry safepoint location doesn't need to be a terminator
Long ago, the poll insertion code assumed that the insertion site was a terminator.  As a result, the entry selection code would split a basic block to ensure it could pass a terminator.  The insertion code was updated quite a while ago - possibly before it ever landed upstream - but the now redundant work was never removed.  

While I'm at it, remove a comment which doesn't apply to the upstreamed code.  

NFC intended.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238254 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 21:16:42 +00:00
Philip Reames
d59f970668 [PlaceSafepoints] Cleanup InsertSafepointPoll function
While working on another change, I noticed that the naming in this function was mildly deceptive.  While fixing that, I took the oppurtunity to modernize some of the code.  NFC intended.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238252 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-26 21:03:23 +00:00
Craig Topper
002c5281ef Use range-based for loops. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238154 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-25 20:01:18 +00:00
Bjorn Steinbrink
0cb6d37dea Remove conflicting attributes before adding deduced readonly/readnone
Summary:
In case of functions that have a pointer argument and only pass it to
each other, the function attributes pass deduces that the pointer should
get the readnone attribute, but fails to remove a readonly attribute
that may already have been present.

Reviewers: nlewycky

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238152 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-25 19:46:38 +00:00
NAKAMURA Takumi
4d3b6d43cc Reformat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238126 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-25 01:43:34 +00:00
NAKAMURA Takumi
f61fb0c9a7 Prune CRLFs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238125 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-25 01:43:23 +00:00
Chandler Carruth
3dd00ff834 [Unroll] Switch from an eagerly populated SCEV cache to one that is
lazily built.

Also, make it a much more generic SCEV cache, which today exposes only
a reduced GEP model description but could be extended in the future to
do other profitable caching of SCEV information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238124 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-25 01:00:46 +00:00
Craig Topper
2077fc4acf Give more meaningful names than I and J to some for loop variables after converting to range-based loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238095 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 08:45:10 +00:00
Craig Topper
2b6e06c46a Fix an unused variable warning in release builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238094 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 08:20:33 +00:00
Craig Topper
01fc7e7a0f Use range-based for loops. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238093 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 08:01:41 +00:00
Philip Reames
e00c0df2c4 Extend EarlyCSE to handle basic cases from JumpThreading and CVP
This patch extends EarlyCSE to take advantage of the information that a controlling branch gives us about the value of a Value within this and dominated basic blocks. If the current block has a single predecessor with a controlling branch, we can infer what the branch condition must have been to execute this block. The actual change to support this is downright simple because EarlyCSE's existing scoped hash table logic deals with most of the complexity around merging.

The patch actually implements two optimizations.
1) The first is analogous to JumpThreading in that it enables EarlyCSE's CSE handling to fold branches which are exactly redundant due to a previous branch to branches on constants. (It doesn't actually replace the branch or change the CFG.) This is pretty clearly a win since it enables substantial CFG simplification before we start trying to inline.
2) The second is analogous to CVP in that it exploits the knowledge gained to replace dominated *uses* of the original value. EarlyCSE does not otherwise reason about specific uses, so this is the more arguable one. It does enable further simplication and constant folding within the rest of the visit by EarlyCSE.

In both cases, the added code only handles the easy dominance based case of each optimization. The general case is deferred to the existing passes.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238071 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 23:53:24 +00:00
David Majnemer
12baade498 [InstCombine] Don't eagerly propagate nsw for A*B+A*C => A*(B+C)
InstCombine transforms A *nsw B +nsw A *nsw C to A *nsw (B + C).
This is incorrect -- e.g. if A = -1, B = 1, C = INT_SMAX. Then
nothing in the LHS overflows, but the multiplication in RHS overflows.

We need to first make sure that we won't multiple by INT_SMAX + 1.

Test case `add_of_mul` contributed by Sanjoy Das.

This fixes PR23635.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238066 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 23:02:11 +00:00
Chandler Carruth
15fe7cf70f [Unroll] Separate the logic for testing each iteration of the loop,
accumulating estimated cost, and other loop-centric logic from the logic
used to analyze instructions in a particular iteration.

This makes the visitor very narrow in scope -- all it does is visit
instructions, update a map of simplified values, and return whether it
is able to optimize away a particular instruction.

The two cost metrics are now returned as an optional struct. When the
optional is left unengaged, there is no information about the unrolled
cost of the loop, when it is engaged the cost metrics are available to
run against the thresholds.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238033 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 17:41:35 +00:00
David Majnemer
fe0d65bcc6 [InstSimplify] Handle some overflow intrinsics in InstSimplify
This change does a few things:
- Move some InstCombine transforms to InstSimplify
- Run SimplifyCall from within InstCombine::visitCallInst
- Teach InstSimplify to fold [us]mul_with_overflow(X, undef) to 0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237995 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 03:56:46 +00:00
Chandler Carruth
edcdc5cb6a [Unroll] Replace a hand-wavy FIXME with a FIXME that explains the actual
problem instead of suggesting doing something that is trivial to do but
incorrect given the current design of the libraries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237994 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 03:07:28 +00:00
Chandler Carruth
f5ed85b2c8 [Unroll] Extract the logic for caching SCEV-modeled GEPs with their
simplified model for use simulating each iteration into a separate
helper function that just returns the cache.

Building this cache had nothing to do with the rest of the unroll
analysis and so this removes an unnecessary coupling, etc. It should
also make it easier to think about the concept of providing fast cached
access to basic SCEV models as an orthogonal concept to the overall
unroll simulation.

I'd really like to see this kind of caching logic folded into SCEV
itself, it seems weird for us to provide it at this layer rather than
making repeated queries into SCEV fast all on their own.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237993 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 03:02:22 +00:00
Chandler Carruth
9233137390 [Unroll] Refactor the accumulation of optimized instruction costs into
a single location.

This reduces code duplication a bit and will also pave the way for
a better separation between the visitation algorithm and the unroll
analysis.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237990 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 02:47:29 +00:00
Philip Reames
2c78f9499c [LICM] Sinking doesn't involve the preheader
PR23608 pointed out that using the preheader to gain a context instruction isn't always legal because a loop might not have a preheader.  When looking into that, I realized that using the preheader to determine legality for sinking is questionable at best.  Given no test covers that case and the original commit didn't seem to intend it, I restructured the code to only ask context sensative queries for hoising of loads and stores.  This is effectively a partial revert of 237593.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237985 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 02:14:05 +00:00
Daniel Berlin
4ea24c84fb MergedLoadStoreMotion preserves MemoryDependenceAnalysis, it does not require it.
(It already was coded assuming it can sometimes be null, so no other changes are necessary)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237978 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 00:13:05 +00:00
Jingyue Wu
41cf9ae1b8 [NaryReassoc] reassociate GEP for CSE
Summary:
x = &a[i];
y = &a[i + j];

=>

y = x + j;

along with some refactoring work such as extracting method
findClosestMatchingDominator.

Depends on D9786 which provides the ScalarEvolution::getGEPExpr interface.

Test Plan: nary-gep.ll

Reviewers: meheff, broune

Reviewed By: broune

Subscribers: jholewinski, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237971 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 23:17:30 +00:00
David Majnemer
41af60bdc0 [InstCombine] X - 0 is equal to X, not undef
A refactoring made @llvm.ssub.with.overflow.i32(i32 %X, i32 0) transform
into undef instead of %X.

This fixes PR23624.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237968 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 23:04:21 +00:00
Benjamin Kramer
4c919af335 [LoopDistribute] Remove a layer of pointer indirection.
Just store InstPartitions directly into the std::list. No functional change
intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237930 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 18:32:07 +00:00
Igor Laevsky
897d9bccdc [RewriteStatepointsForGC] Fix debug assertion during derivable pointer rematerialization
Correct assertion would be that there is no other uses from chain we are currently cloning. It is ok to have other uses of values not from this chain.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237899 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 13:02:14 +00:00
Ahmed Bougacha
8eca988b00 [MemCpyOpt] Do move the memset, but look at its dest's dependencies.
In effect a partial revert of r237858, which was a dumb shortcut.
Looking at the dependencies of the destination should be the proper
fix: if the new memset would depend on anything other than itself,
the transformation isn't correct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237874 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 01:43:39 +00:00
Ahmed Bougacha
d591505d9f [MemCpyOpt] Pass Instruction to IRBuilder, no need for NextNode. NFC.
We're erasing the instructions anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237861 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 00:08:35 +00:00
Ahmed Bougacha
6d1485e974 [MemCpyOpt] Don't move the memset when optimizing memset+memcpy.
Fixes PR23599, another miscompile introduced by r235232: when there is
another dependency on the destination of the created memset (i.e., the
part of the original destination that the memcpy doesn't depend on)
between the memcpy and the original memset, we would insert the created
memset after the memcpy, and thus after the other dependency.

Instead, insert the created memset right after the old one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237858 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 23:55:16 +00:00
James Molloy
d594ba0815 Reapply r237539 with a fix for the Chromium build.
Make sure if we're truncating a constant that would then be sign extended
that the sign extension of the truncated constant is the same as the
original constant.

> Canonicalize min/max expressions correctly.
>
> This patch introduces a canonical form for min/max idioms where one operand
> is extended or truncated. This often happens when the other operand is a
> constant. For example:
>
> %1 = icmp slt i32 %a, i32 0
> %2 = sext i32 %a to i64
> %3 = select i1 %1, i64 %2, i64 0
>
> Would now be canonicalized into:
>
> %1 = icmp slt i32 %a, i32 0
> %2 = select i1 %1, i32 %a, i32 0
> %3 = sext i32 %2 to i64
>
> This builds upon a patch posted by David Majenemer
> (https://www.marc.info/?l=llvm-commits&m=143008038714141&w=2). That pass
> passively stopped instcombine from ruining canonical patterns. This
> patch additionally actively makes instcombine canonicalize too.
>
> Canonicalization of expressions involving a change in type from int->fp
> or fp->int are not yet implemented.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237821 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 18:41:25 +00:00
Pete Cooper
9584e07a9c Change Function::getIntrinsicID() to return an Intrinsic::ID. NFC.
Now that Intrinsic::ID is a typed enum, we can forward declare it and so return it from this method.

This updates all users which were either using an unsigned to store it, or had a now unnecessary cast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237810 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 17:16:39 +00:00
Aaron Ballman
cc3dffb519 Silencing a -Wsign-compare warning; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237794 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 14:53:50 +00:00
Swaroop Sridhar
95d08bce87 Add a GCStrategy for CoreCLR
This change adds a new GC strategy for supporting the CoreCLR runtime.

This strategy is currently identical to Statepoint-example GC, 
but is necessary for several upcoming changes specific to CoreCLR, such as:

1. Base-pointers not explicitly reported for interior pointers
2. Different format for stack-map encoding
3. Location of Safe-point polls: polls are only needed before loop-back edges and before tail-calls (not needed at function-entry)
4. Runtime specific handshake between calls to managed/unmanaged functions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237753 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 01:07:23 +00:00
Philip Reames
a5703bc52e [PlaceSafepoints] Stop special casing some intrinsics
We were special casing a handful of intrinsics as not needing a safepoint before them.  After running into another valid case - memset - I took a closer look and realized that almost no intrinsics need to have a safepoint poll before them.  Restructure the code to make that apparent so that we stop hitting these bugs.  The only intrinsics which need a safepoint poll before them are ones which can run arbitrary code.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237744 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 23:40:11 +00:00
Hans Wennborg
c0f6113287 Revert r237539: "Reapply r237520 with another fix for infinite looping"
This caused PR23583.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237739 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 23:06:30 +00:00
Jingyue Wu
31d2ee7360 [Speculation] NFC: more header comments
explaining how it differs from SpeculativeExecuteBB in SimplifyCFG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237724 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 20:52:45 +00:00
Igor Laevsky
92948b04c3 [RewriteStatepointsForGC] Fix up naming in "relocationViaAlloca" and run it through clang-format.
Differential Revision: http://reviews.llvm.org/D9774



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237703 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 16:29:43 +00:00
Wei Mi
51891f2364 Remove the InstructionSimplifierPass immediately after InstructionCombiningPass.
InstructionCombiningPass was added after LoopUnrollPass in r237395. Because
InstructionCombiningPass is strictly more powerful than InstructionSimplifierPass,
remove the unnecessary InstructionSimplifierPass.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237702 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 16:09:11 +00:00
Igor Laevsky
42737039d5 [RewriteStatepointsForGC] For some values (like gep's and bitcasts) it's cheaper to clone them after statepoint than to emit proper relocates for them. This change implements this logic. There is alredy similar optimization in CodeGenPrepare, but doing so during RewriteStatepointsForGC allows to capture more opprtunities such as relocates in loops and longer instruction chains.
Differential Revision: http://reviews.llvm.org/D9774



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237701 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 15:59:05 +00:00
David Blaikie
042dd34f9c Simplify IRBuilder::CreateCall* by using ArrayRef+initializer_list/braced init only
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237624 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 22:13:54 +00:00
Chen Li
2306579644 [PlaceSafepoints] Assertion on that gc_result can not have preceding phis should only apply to invoke statepoint
Summary: When PlaceSafepoints pass replaces old return result with gc_result from statepoint, it asserts that gc_result can not have preceding phis in its parent block. This is only true on invoke statepoint, which terminates the block and puts its result at the beginning of the normal successor block. Call statepoint does not terminate the block and thus its result is in the same block with it. There should be no restriction on whether there are phis or not.

Reviewers: reames, igor-laevsky

Reviewed By: igor-laevsky

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237597 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 19:02:25 +00:00
Sanjoy Das
0799eb1140 Exploit dereferenceable_or_null attribute in LICM pass
Summary:
Allow hoisting of loads from values marked with dereferenceable_or_null
attribute. For values marked with the attribute perform
context-sensitive analysis to determine whether it's known-non-null or
not.

Patch by Artur Pilipenko!

Reviewers: hfinkel, sanjoy, reames

Reviewed By: reames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237593 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 18:07:00 +00:00