History log of /external/llvm/lib/CodeGen/MachineSink.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
de2d8694e25a814696358e95141f4b1aa4d8847e 20-Sep-2016 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master LLVM for rebase to r275480

Bug: http://b/31320715

This merges commit 7dcf7f03e005379ef2f06db96aa93f06186b66d5 from
aosp/dev.

Test: Build AOSP and run RenderScript tests (host tests for slang and
libbcc, RsTest, CTS)

Change-Id: Iaf3738f74312d875e69f61d604ac058f381a2a1a
/external/llvm/lib/CodeGen/MachineSink.cpp
f3ef5332fa3f4d5ec72c178a2b19dac363a19383 04-Mar-2016 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master LLVM for rebase to r256229

http://b/26987366

Change-Id: I1f29c4676a8abe633ab5707dded58d846c973d50
/external/llvm/lib/CodeGen/MachineSink.cpp
6948897e478cbd66626159776a8017b3c18579b9 01-Jul-2015 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master LLVM for rebase to r239765

Bug: 20140355: This rebase pulls the upstream fix for the spurious
warnings mentioned in the bug.

Change-Id: I7fd24253c50f4d48d900875dcf43ce3f1721a3da
/external/llvm/lib/CodeGen/MachineSink.cpp
ebe69fe11e48d322045d5949c83283927a0d790b 23-Mar-2015 Stephen Hines <srhines@google.com> Update aosp/master LLVM for rebase to r230699.

Change-Id: I2b5be30509658cb8266be782de0ab24f9099f9b9
/external/llvm/lib/CodeGen/MachineSink.cpp
37ed9c199ca639565f6ce88105f9e39e898d82d0 01-Dec-2014 Stephen Hines <srhines@google.com> Update aosp/master LLVM for rebase to r222494.

Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
/external/llvm/lib/CodeGen/MachineSink.cpp
bfc2d688b591c574c0cc788348c74545ce894efa 17-Oct-2014 Stephen Hines <srhines@google.com> Bring in fixes for Cortex-A53 errata + build updates.

Bug: 18034609

Change-Id: I2cf0094eb9df801a84274ff29018431d75da89dd
/external/llvm/lib/CodeGen/MachineSink.cpp
dce4a407a24b04eebc6a376f8e62b41aaa7b071f 29-May-2014 Stephen Hines <srhines@google.com> Update LLVM for 3.5 rebase (r209712).

Change-Id: I149556c940fb7dc92d075273c87ff584f400941f
/external/llvm/lib/CodeGen/MachineSink.cpp
36b56886974eae4f9c5ebc96befd3e7bfe5de338 24-Apr-2014 Stephen Hines <srhines@google.com> Update to LLVM 3.5a.

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/lib/CodeGen/MachineSink.cpp
e4b44c1617b82ba4bb5451df83cfc214b1e5d5f5 14-Oct-2013 Will Dietz <wdietz2@illinois.edu> MachineSink: Fix and tweak critical-edge breaking heuristic.

Per original comment, the intention of this loop
is to go ahead and break the critical edge
(in order to sink this instruction) if there's
reason to believe doing so might "unblock" the
sinking of additional instructions that define
registers used by this one. The idea is that if
we have a few instructions to sink "together"
breaking the edge might be worthwhile.

This commit makes a few small changes
to help better realize this goal:

First, modify the loop to ignore registers
defined by this instruction. We don't
sink definitions of physical registers,
and sinking an SSA definition isn't
going to unblock an upstream instruction.

Second, ignore uses of physical registers.
Instructions that define physical registers are
rejected for sinking, and so moving this one
won't enable moving any defining instructions.
As an added bonus, while virtual register
use-def chains are generally small due
to SSA goodness, iteration over the uses
and definitions (used by hasOneNonDBGUse)
for physical registers like EFLAGS
can be rather expensive in practice.
(This is the original reason for looking at this)

Finally, to keep things simple continue
to only consider this trick for registers that
have a single use (via hasOneNonDBGUse),
but to avoid spuriously breaking critical edges
only do so if the definition resides
in the same MBB and therefore this one directly
blocks it from being sunk as well.
If sinking them together is meant to be,
let the iterative nature of this pass
sink the definition into this block first.

Update tests to accomodate this change,
add new testcase where sinking avoids pipeline stalls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192608 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
a0ec3f9b7b826b9b40b80199923b664bad808cce 14-Jul-2013 Craig Topper <craig.topper@gmail.com> Use SmallVectorImpl& instead of SmallVector to avoid repeating small vector size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186274 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
f22fd3f7b557a967b1edc1fa9ae770006a39e97c 03-Jul-2013 Craig Topper <craig.topper@gmail.com> Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
d04a8d4b33ff316ca4cf961e06c9e312eff8e64f 03-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Use the new script to sort the includes of every file under lib.

Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
feab72c20acc97f8942148189c06e443b29df841 16-Oct-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Remove unused BitVectors from getAllocatableSet().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165999 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
f99efdf3290b438a2cd74304e4299d50bce2b397 31-Jul-2012 Manman Ren <mren@apple.com> MachineSink: Sort the successors before trying to find SuccToSinkTo.

Use stable_sort instead of sort. Follow-up to r161062.

rdar://11980766


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161075 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
53b59d1d974184657edfd22779e0bb3653d164ec 31-Jul-2012 Manman Ren <mren@apple.com> MachineSink: Sort the successors before trying to find SuccToSinkTo.

One motivating example is to sink an instruction from a basic block which has
two successors: one outside the loop, the other inside the loop. We should try
to sink the instruction outside the loop.

rdar://11980766


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161062 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
1dd8c8560d45d36a8e507cd014352f1d313f9f9e 08-Feb-2012 Andrew Trick <atrick@apple.com> Codegen pass definition cleanup. No functionality.

Moving toward a uniform style of pass definition to allow easier target configuration.
Globally declare Pass ID.
Globally declare pass initializer.
Use INITIALIZE_PASS consistently.
Add a call to the initializer from CodeGen.cpp.
Remove redundant "createPass" functions and "getPassName" methods.

While cleaning up declarations, cleaned up comments (sorry for large diff).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150100 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
1df91b0e54bc62f8fc7a06a4f75220e40aa2dfe0 08-Feb-2012 Andrew Trick <atrick@apple.com> whitespace

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150094 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
c035c940a656f34a58ebe22fcc5f9b2a7d8e97fb 16-Jan-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Extract method for detecting constant unallocatable physregs.

It is safe to move uses of such registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
5211134fbd35bf0befc60888860010b23c27ee5a 15-Dec-2011 Devang Patel <dpatel@apple.com> Do not sink instruction, if it is not profitable.

On ARM, peephole optimization for ABS creates a trivial cfg triangle which tempts machine sink to sink instructions in code which is really straight line code. Sometimes this sinking may alter register allocator input such that use and def of a reg is divided by a branch in between, which may result in extra spills. Now mahine sink avoids sinking if final sink destination is post dominator.

Radar 10266272.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146604 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
f5b9a74f0a13afe3b7a8388be81e4062b63e4c30 09-Dec-2011 Devang Patel <dpatel@apple.com> Fix comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146226 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
2b1d77355bdeb9b7515b16bdd049c39ed78fca4b 09-Dec-2011 Devang Patel <dpatel@apple.com> Update stale comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146220 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
7f7f0902a640c26e9ce70b5869fc7de3b8b27918 09-Dec-2011 Devang Patel <dpatel@apple.com> Revert r146184. I am seeing performance regression cause by this patch in one test case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146205 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
e265bcf1a609c81c197971cd392e98a12d97162d 08-Dec-2011 Devang Patel <dpatel@apple.com> Refactor. No intentional functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146187 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
cf405ba7a6e9448b753d9b72940059530c70ea90 08-Dec-2011 Devang Patel <dpatel@apple.com> Filter "sink to" candidate blocks sooner. This avoids unnecessary computation to determine whether the block dominates all uses or not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146184 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
5a96b3dad2f634c9081c8b2b6c2575441dc5a2bd 07-Dec-2011 Evan Cheng <evan.cheng@apple.com> Add bundle aware API for querying instruction properties and switch the code
generator to it. For non-bundle instructions, these behave exactly the same
as the MC layer API.

For properties like mayLoad / mayStore, look into the bundle and if any of the
bundled instructions has the property it would return true.
For properties like isPredicable, only return true if *all* of the bundled
instructions have the property.
For properties like canFoldAsLoad, isCompare, conservatively return false for
bundles.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
541a81cc2bb8b66960e788b1d8441536354b79b8 07-Sep-2011 Devang Patel <dpatel@apple.com> While sinking machine instructions, sink matching DBG_VALUEs also otherwise live debug variable pass will drop DBG_VALUEs on the floor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139208 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
cfea985f5319991fcb1feac3e66f645da4a0b507 11-Apr-2011 Evan Cheng <evan.cheng@apple.com> Fix a couple of places where changes are made but not tracked.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129287 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
081c34b725980f995be9080eaec24cd3dfaaf065 19-Oct-2010 Owen Anderson <resistor@mac.com> Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which
must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize
the pass's dependencies.

Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the
CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
before parsing commandline arguments.

I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems
with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass
registration/creation, please send the testcase to me directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116820 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
2ab36d350293c77fc8941ce1023e4899df7e3a82 12-Oct-2010 Owen Anderson <resistor@mac.com> Begin adding static dependence information to passes, which will allow us to
perform initialization without static constructors AND without explicit initialization
by the client. For the moment, passes are required to initialize both their
(potential) dependencies and any passes they preserve. I hope to be able to relax
the latter requirement in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
ce665bd2e2b581ab0858d1afe359192bac96b868 08-Oct-2010 Owen Anderson <resistor@mac.com> Now with fewer extraneous semicolons!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
b0cdf8a4466d02c66c84b6b30953709fa9225a30 23-Sep-2010 Evan Cheng <evan.cheng@apple.com> Don't sink insert_subreg, subreg_to_reg, reg_sequence. They are meant to be
close to their sources to facilitate coalescing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114631 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
44be1a8d661cfab0cc3d11b0dd158271b2d2ca04 21-Sep-2010 Evan Cheng <evan.cheng@apple.com> Enable machine sinking critical edge splitting. e.g.

define double @foo(double %x, double %y, i1 %c) nounwind {
%a = fdiv double %x, 3.2
%z = select i1 %c, double %a, double %y
ret double %z
}

Was:
_foo:
divsd LCPI0_0(%rip), %xmm0
testb $1, %dil
jne LBB0_2
movaps %xmm1, %xmm0
LBB0_2:
ret

Now:
_foo:
testb $1, %dil
je LBB0_2
divsd LCPI0_0(%rip), %xmm0
ret
LBB0_2:
movaps %xmm1, %xmm0
ret

This avoids the divsd when early exit is taken.
rdar://8454886


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114372 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
7af6dc47a552d0d7d09752ad2e747d3973125b48 20-Sep-2010 Evan Cheng <evan.cheng@apple.com> Avoid splitting critical edge twice for a set of PHI uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
2399786b279b6db7077ac36020153714530365df 18-Sep-2010 Evan Cheng <evan.cheng@apple.com> Fix code that break critical edges for PHI uses. Watch out for multiple PHIs in different blocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114270 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
6edb0eac87a6e46b89de3ad5d8e39c41969e2a54 18-Sep-2010 Evan Cheng <evan.cheng@apple.com> Teach machine sink to
1) Do forward copy propagation. This makes it easier to estimate the cost of the
instruction being sunk.
2) Break critical edges on demand, including cases where the value is used by
PHI nodes.
Critical edge splitting is not yet enabled by default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114227 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
f942c13af8187415e59e82e0bc92420c6fd59009 20-Aug-2010 Evan Cheng <evan.cheng@apple.com> Update debug logs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111575 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
e5e7946018844978d0ac09fdb35998a53b43ad34 19-Aug-2010 Evan Cheng <evan.cheng@apple.com> It's possible to sink a def if its local uses are PHI's.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
c546c754597cdc99b2dfa70b4a1054575daa753a 19-Aug-2010 Evan Cheng <evan.cheng@apple.com> Remove disabled assertion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111531 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
4dc301a7c5fc8e18e7773f8e0d2c495ae1cc44f7 19-Aug-2010 Evan Cheng <evan.cheng@apple.com> Teach machine-sink to break critical edges when appropriate. Work in progress.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111530 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
c3439ad63f4d145ca7357b7918bd72dfde8213d3 19-Aug-2010 Evan Cheng <evan.cheng@apple.com> If any def of a machine-sink candidate has local uses, it's obviously not safe to sink it to a successor block. This bug has been hidden because a later check for critical-edge disable these illegal optimizations. This patch should significantly reduce the amount of time spent on checking dominator information for obviously unsafe sinking.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111450 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
90c579de5a383cee278acc3f7e7b9d0a656e6a35 06-Aug-2010 Owen Anderson <resistor@mac.com> Reapply r110396, with fixes to appease the Linux buildbot gods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
1f74590e9d1b9cf0f1f81a156efea73f76546e05 06-Aug-2010 Owen Anderson <resistor@mac.com> Revert r110396 to fix buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
9ccaf53ada99c63737547c0235baeb8454b04e80 06-Aug-2010 Owen Anderson <resistor@mac.com> Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier. Clean up APIs related to this change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
d13db2c59cc94162d6cf0a04187d408bfef6d4a7 22-Jul-2010 Owen Anderson <resistor@mac.com> Fix batch of converting RegisterPass<> to INTIALIZE_PASS().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
730c07e50d03be3d64fd4d808c590e6890d32178 25-Jun-2010 Bill Wendling <isanbard@gmail.com> - Reapply r106066 now that the bzip2 build regression has been fixed.
- 2010-06-25-CoalescerSubRegDefDead.ll is the testcase for r106878.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106880 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
d24c9d5f91442f893bebc2ea8d5ee845bc8b77a9 23-Jun-2010 Daniel Dunbar <daniel@zuster.org> Revert r106066, "Create a more targeted fix for not sinking instructions into a range where it"... it causes bzip2 to be miscompiled by Clang.

Conflicts:

lib/CodeGen/MachineSink.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
504c0cda91a6c6c8828c5a55f1516881b6f99e8c 16-Jun-2010 Bill Wendling <isanbard@gmail.com> Improve comment to include that the use of a preg is also verboten in this situation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106119 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
d361a77f14997d4674f41545103acad3a4a902f1 16-Jun-2010 Bill Wendling <isanbard@gmail.com> Create a more targeted fix for not sinking instructions into a range where it
will conflict with another live range. The place which creates this scenerio is
the code in X86 that lowers a select instruction by splitting the MBBs. This
eliminates the need to check from the bottom up in an MBB for live pregs.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106066 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
6ee358b4eb92298357687cb460dde8e26678aca2 04-Jun-2010 Jim Grosbach <grosbach@apple.com> Cleanup 80-column and trim trailing whitespace

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105435 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
869d60d39d579b2051a8e34f460de72f071c2172 03-Jun-2010 Bill Wendling <isanbard@gmail.com> Machine sink could potentially sink instructions into a block where the physical
registers it defines then interfere with an existing preg live range.

For instance, if we had something like these machine instructions:

BB#0
... = imul ... EFLAGS<imp-def,dead>
test ..., EFLAGS<imp-def>
jcc BB#2 EFLAGS<imp-use>

BB#1
... ; fallthrough to BB#2

BB#2
... ; No code that defines EFLAGS
jcc ... EFLAGS<imp-use>

Machine sink will come along, see that imul implicitly defines EFLAGS, but
because it's "dead", it assumes that it can move imul into BB#2. But when it
does, imul's "dead" imp-def of EFLAGS is raised from the dead (a zombie) and
messes up the condition code for the jump (and pretty much anything else which
relies upon it being correct).

The solution is to know which pregs are live going into a basic block. However,
that information isn't calculated at this point. Nor does the LiveVariables pass
take into account non-allocatable physical registers. In lieu of this, we do a
*very* conservative pass through the basic block to determine if a preg is live
coming out of it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105387 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
05c68374c1c73599a0b7044ad09fb4827d128ec5 03-Jun-2010 Bill Wendling <isanbard@gmail.com> Compulsive reformating. No functionalitical changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105359 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
e6cd757e6800b9b94a6459ec148c0624c4f2e3c1 13-May-2010 Dan Gohman <gohman@apple.com> Teach MachineLICM and MachineSink how to clear kill flags conservatively
when they move instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103737 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
626f3d7a57f4f2a46880331fdacce259195213ef 16-Apr-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Avoid sinking machine instructions into a loop.

MachineLoopInfo is already available when MachineSinking runs, so the check is
free.

There is no test case because it would require a critical edge into a loop, and
CodeGenPrepare splits those. This check is just to be extra careful.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101420 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
8d17160e2cf9a1645b4b06b0cd575aef6195b108 13-Apr-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Teach MachineSinking to handle easy critical edges.

Sometimes it is desirable to sink instructions along a critical edge:

x = ...
if (a && b) ...
else use(x);

The 'a && b' condition creates a critical edge to the else block, but we still
want to sink the computation of x into the block. The else block is dominated by
the parent block, so we are not pushing instructions into new code paths.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101165 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
c4ae94dee8c9a07334de7ffd85c45893208cca77 05-Apr-2010 Dan Gohman <gohman@apple.com> Don't do code sinking on unreachable blocks. It's unprofitable and hazardous.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100455 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
b0812f114b83a32c4b90a4b553c7177c557558b5 05-Mar-2010 Dale Johannesen <dalej@apple.com> Fix some more places where dbg_value affected codegen.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97765 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
ac1abde05b7e6956c01deb6557539bee8fea30f4 02-Mar-2010 Evan Cheng <evan.cheng@apple.com> Swap parameters of isSafeToMove and isSafeToReMat for consistency.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
518bb53485df640d7b7e3f6b0544099020c42aa7 09-Feb-2010 Chris Lattner <sabre@nondot.org> move target-independent opcodes out of TargetInstrInfo
into TargetOpcodes.h. #include the new TargetOpcodes.h
into MachineInstr. Add new inline accessors (like isPHI())
to MachineInstr, and start using them throughout the
codebase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95687 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
c19a9cdfac813360bcedd374df6fcd0a3dc12252 05-Jan-2010 David Greene <greened@obbligato.org> Change errs() to dbgs().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92593 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
f5a86f45e75ec744c203270ffa03659eb0a220c1 25-Oct-2009 Nick Lewycky <nicholas@mxc.ca> Remove includes of Support/Compiler.h that are no longer needed after the
VISIBILITY_HIDDEN removal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
6726b6d75a8b679068a58cb954ba97cf9d1690ba 25-Oct-2009 Nick Lewycky <nicholas@mxc.ca> Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
dfffba6a83b7f79c8853e1412a93442b7a9b825d 19-Oct-2009 Dan Gohman <gohman@apple.com> Fix a typo in a comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84504 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
4e9785ed8ad34f01ccb459796d85a56600ed592b 19-Oct-2009 Dan Gohman <gohman@apple.com> Change a few instance variables to be local variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
a70dca156fa76d452f54829b5c5f962ddfd94ef2 10-Oct-2009 Dan Gohman <gohman@apple.com> Factor out LiveIntervalAnalysis' code to determine whether an instruction
is trivially rematerializable and integrate it into
TargetInstrInfo::isTriviallyReMaterializable. This way, all places that
need to know whether an instruction is rematerializable will get the
same answer.

This enables the useful parts of the aggressive-remat option by
default -- using AliasAnalysis to determine whether a memory location
is invariant, and removes the questionable parts -- rematting operations
with virtual register inputs that may not be live everywhere.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83687 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
e33f44cfc547359bc28526e4c5e1852b600b4448 07-Oct-2009 Dan Gohman <gohman@apple.com> Replace TargetInstrInfo::isInvariantLoad and its target-specific
implementations with a new MachineInstr::isInvariantLoad, which uses
MachineMemOperands and is target-independent. This brings MachineLICM
and other functionality to targets which previously lacked an
isInvariantLoad implementation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
45094e34bcbb133aa0bbe55710e25369df0e02ed 26-Sep-2009 Dan Gohman <gohman@apple.com> Don't hoist or sink instructions with physreg uses if the physreg is
allocatable. Even if it doesn't appear to have any defs, it may latter
on after register allocation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82834 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
19778e7558bc161b87920c5be9cc01bb84a08de2 26-Sep-2009 Dan Gohman <gohman@apple.com> Fix MachineSink to be able to sink instructions that use physical registers
which have no defs anywhere in the function. In particular, this fixes sinking
of instructions that reference RIP on x86-64, which is currently being modeled
as a register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82815 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
29438d13e036cb454b2089b8e175fc93f62bbba2 26-Sep-2009 Dan Gohman <gohman@apple.com> Simplify this code by using use_iterator instead of reg_iterator
and skipping the defs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82811 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
cf143a4d917699f8f4202f331fa9e184070471fb 23-Aug-2009 Chris Lattner <sabre@nondot.org> remove std::ostream versions of printing stuff for MBB and MF,
upgrading a few things to use raw_ostream


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79811 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
1e973aae79476d003b58dc430d81f964c2ea5853 22-Aug-2009 Bill Wendling <isanbard@gmail.com> Convert DOUT to DEBUG(errs()...).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79755 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
a5225add0d748bd6396f3e4e77669a8996d9ecec 05-Aug-2009 Dan Gohman <gohman@apple.com> Various comment fixes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
845012e6d31799c7fbd1193fa1af8ee2d12e9231 01-Aug-2009 Dan Gohman <gohman@apple.com> Use setPreservesAll and setPreservesCFG in CodeGen passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77754 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
296185c264a47cadd52c8d3290a54837cc32cbe5 10-Apr-2009 Chris Lattner <sabre@nondot.org> fix two problems with machine sinking:
1. Sinking would crash when the first instruction of a block was
sunk due to iterator problems.
2. Instructions could be sunk to their current block, causing an
infinite loop.

This fixes PR3968


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68787 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
b599979ab591a6f4557337a4190153094725ef45 15-Feb-2009 Evan Cheng <evan.cheng@apple.com> Fix PR3522. It's not safe to sink into landing pad BB's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64582 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
b6f5417edb8ad11e06d3a6527e452945e5349a97 07-Feb-2009 Evan Cheng <evan.cheng@apple.com> Don't sink the instruction if TargetRegisterInfo::isSafeToMoveRegClassDefs doesn't think it's safe. This works around PR1911.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
d68a07650cdb2e18f18f362ba533459aa10e01b6 05-Jan-2009 Dan Gohman <gohman@apple.com> Tidy up #includes, deleting a bunch of unnecessary #includes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61715 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
d735b8019b0f297d7c14b55adcd887af24d8e602 03-Oct-2008 Dan Gohman <gohman@apple.com> Switch the MachineOperand accessors back to the short names like
isReg, etc., from isRegister, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
014278e6a11fa0767853b831e5bf51b95bf541c5 13-Sep-2008 Dan Gohman <gohman@apple.com> Remove isImm(), isReg(), and friends, in favor of
isImmediate(), isRegister(), and friends, to avoid confusion
about having two different names with the same meaning. I'm
not attached to the longer names, and would be ok with
changing to the shorter names if others prefer it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56189 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
ae73dc1448d25b02cabc7c64c86c64371453dda8 04-Sep-2008 Dan Gohman <gohman@apple.com> Tidy up several unbeseeming casts from pointer to intptr_t.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
844731a7f1909f55935e3514c9e713a62d67662e 13-May-2008 Dan Gohman <gohman@apple.com> Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
b27087f5aa574f875598f4a309b7dd687c64a455 13-Mar-2008 Evan Cheng <evan.cheng@apple.com> Refactor some code out of MachineSink into a MachineInstr query.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48311 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
6f0d024a534af18d9e60b3ea757376cd8a3a980e 10-Feb-2008 Dan Gohman <gohman@apple.com> Rename MRegisterInfo to TargetRegisterInfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46930 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
aad193a7e9f8eb4b558e16c2b54c31dee54f5f1e 12-Jan-2008 Chris Lattner <sabre@nondot.org> implement support for sinking a load out the bottom of a block that
has no stores between the load and the end of block. This works
great and sinks hundreds of stores, but we can't turn it on because
machineinstrs don't have volatility information and we don't want to
sink volatile stores :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45894 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
a22edc82cab86be4cb8876da1e6e78f82bb47a3e 11-Jan-2008 Chris Lattner <sabre@nondot.org> Simplify the side effect stuff a bit more and make licm/sinking
both work right according to the new flags.

This removes the TII::isReallySideEffectFree predicate, and adds
TII::isInvariantLoad.

It removes NeverHasSideEffects+MayHaveSideEffects and adds
UnmodeledSideEffects as machine instr flags. Now the clients
can decide everything they need.

I think isRematerializable can be implemented in terms of the
flags we have now, though I will let others tackle that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45843 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
244588820867ab4e42f72c266196b848919bfebb 10-Jan-2008 Chris Lattner <sabre@nondot.org> Clamp down on sinking of lots of instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45841 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
e430e1c07278d28f58fd94bac508469b8c1d1933 05-Jan-2008 Chris Lattner <sabre@nondot.org> The current impl is really trivial, add some comments about how it can be made better.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45625 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
ba84ed7e9234b7a84009b3cb8475d1be7b1529d9 05-Jan-2008 Chris Lattner <sabre@nondot.org> don't sink anything with side effects, this makes lots of stuff work, but sinks almost nothing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45617 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
9bb459b55411c45175e599f6f421b7a57060ee57 05-Jan-2008 Chris Lattner <sabre@nondot.org> fix a common crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp
c4ce73f666e7ab9a270982a575101df8aa6160d3 04-Jan-2008 Chris Lattner <sabre@nondot.org> Add a really quick hack at a machine code sinking pass, enabled with --enable-sinking.
It is missing validity checks, so it is known broken. However, it is powerful enough
to compile this contrived code:

void test1(int C, double A, double B, double *P) {
double Tmp = A*A+B*B;
*P = C ? Tmp : A;
}

into:

_test1:
movsd 8(%esp), %xmm0
cmpl $0, 4(%esp)
je LBB1_2 # entry
LBB1_1: # entry
movsd 16(%esp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
LBB1_2: # entry
movl 24(%esp), %eax
movsd %xmm0, (%eax)
ret

instead of:

_test1:
movsd 16(%esp), %xmm0
mulsd %xmm0, %xmm0
movsd 8(%esp), %xmm1
movapd %xmm1, %xmm2
mulsd %xmm2, %xmm2
addsd %xmm0, %xmm2
cmpl $0, 4(%esp)
je LBB1_2 # entry
LBB1_1: # entry
movapd %xmm2, %xmm1
LBB1_2: # entry
movl 24(%esp), %eax
movsd %xmm1, (%eax)
ret

woo.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45570 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/MachineSink.cpp