History log of /external/llvm/lib/Transforms/Scalar/GVN.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
2c3e0051c31c3f5b2328b447eadf1cf9c4427442 06-May-2015 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master LLVM for rebase to r235153

Change-Id: I9bf53792f9fc30570e81a8d80d296c681d005ea7
(cherry picked from commit 0c7f116bb6950ef819323d855415b2f2b0aad987)
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4c5e43da7792f75567b693105cc53e3f1992ad98 08-Apr-2015 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master llvm for rebase to r233350

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

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

Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c6a4f5e819217e1e12c458aed8e7b122e23a3a58 21-Jul-2014 Stephen Hines <srhines@google.com> Update LLVM for rebase to r212749.

Includes a cherry-pick of:
r212948 - fixes a small issue with atomic calls

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

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

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e26299d76e4b1ef0fa9bfc89d55dd1a28a1220f4 12-Nov-2013 Shuxin Yang <shuxin.llvm@gmail.com> Correct a glitch in r194424 which may invalidate iterator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194457 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
6c7a7c6474ea60c40e2dbb15f5b6cf0265098ace 11-Nov-2013 Shuxin Yang <shuxin.llvm@gmail.com> Fix PR17952.

The symptom is that an assertion is triggered. The assertion was added by
me to detect the situation when value is propagated from dead blocks.
(We can certainly get rid of assertion; it is safe to do so, because propagating
value from dead block to alive join node is certainly ok.)

The root cause of this bug is : edge-splitting is conducted on the fly,
the edge being split could be a dead edge, therefore the block that
split the critial edge needs to be flagged "dead" as well.

There are 3 ways to fix this bug:
1) Get rid of the assertion as I mentioned eariler
2) When an dead edge is split, flag the inserted block "dead".
3) proactively split the critical edges connecting dead and live blocks when
new dead blocks are revealed.

This fix go for 3) with additional 2 LOC.

Testing case was added by Rafael the other day.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194424 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
855c29d82c0358f43d1dc22f5330bb31a74adfd1 10-Nov-2013 Bill Wendling <isanbard@gmail.com> Revert "Resurrect r191017 " GVN proceeds in the presence of dead code" plus a fix to PR17307 & 17308."

This causes PR17852.

This reverts commit d93e8a06b2ca09ab18f390cd514b7443e2e571f7.

Conflicts:
test/Transforms/GVN/cond_br2.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194348 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b7ff48e3744a3a9800c65afddfc004977b8102b5 30-Oct-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Fix GVN creating bitcast between address spaces

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193710 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
244d24597497c09ab68969c8bbbdf2576130262c 21-Oct-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Use more type helper functions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193109 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
d93e8a06b2ca09ab18f390cd514b7443e2e571f7 21-Sep-2013 Shuxin Yang <shuxin.llvm@gmail.com> Resurrect r191017 " GVN proceeds in the presence of dead code" plus a fix to PR17307 & 17308.

The problem of r191017 is that when GVN fabricate a val-number for a dead instruction (in order
to make following expr-PRE happy), it forget to fabricate a leader-table entry for it as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191118 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
fc572d87d2bbf39732e43fc761b5173ef0bcc0f7 20-Sep-2013 Joerg Sonnenberger <joerg@bec.de> Revert r191017, it results in segmentation faults in Qt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191104 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1bc7315c022b327a496366a78eb31ba446c699bd 19-Sep-2013 Shuxin Yang <shuxin.llvm@gmail.com> GVN proceeds in the presence of dead code.

This is how it ignores the dead code:
1) When a dead branch target, say block B, is identified, all the
blocks dominated by B is dead as well.

2) The PHIs of those blocks in dominance-frontier(B) is updated such
that the operands corresponding to dead predecessors are replaced
by "UndefVal".

Using lattice's jargon, the "UndefVal" is the "Top" in essence.
Phi node like this "phi(v1 bb1, undef xx)" will be optimized into
"v1" if v1 is constant, or v1 is an instruction which dominate this
PHI node.

3) When analyzing the availability of a load L, all dead mem-ops which
L depends on disguise as a load which evaluate exactly same value as L.

4) The dead mem-ops will be materialized as "UndefVal" during code motion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
81e480463d8bb57776d03cebfd083762909023f1 27-Jul-2013 Nick Lewycky <nicholas@mxc.ca> Reimplement isPotentiallyReachable to make nocapture deduction much stronger.
Adds unit tests for it too.

Split BasicBlockUtils into an analysis-half and a transforms-half, and put the
analysis bits into a new Analysis/CFG.{h,cpp}. Promote isPotentiallyReachable
into llvm::isPotentiallyReachable and move it into Analysis/CFG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187283 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
6227d5c690504c7ada5780c00a635b282c46e275 04-Jul-2013 Craig Topper <craig.topper@gmail.com> Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185606 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4b7b3a7c19db3d0da12a44a0849730296c26fbf9 09-May-2013 Shuxin Yang <shuxin.llvm@gmail.com> [GVN] Split critical-edge on the fly, instead of postpone edge-splitting to next
iteration.

This on step toward non-iterative GVN. My local hack suggests that getting rid
of iteration will speedup GVN by 30%+ on a medium sized input (2k LOC, C++).
I cannot explain why not 2x or more at this moment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181532 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
968d689ec30a0df63d252b8193664e01944edb8b 03-May-2013 Shuxin Yang <shuxin.llvm@gmail.com> Decompose GVN::processNonLocalLoad() (about 400 LOC) into smaller helper functions. No function change.

This function consists of following steps:
1. Collect dependent memory accesses.
2. Analyze availability.
3. Perform fully redundancy elimination, or
4. Perform PRE, depending on the availability

Step 2, 3 and 4 are now moved to three helper routines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181047 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
556dd3a9a9068337a84e3ba32253a10cd1ab67dc 02-May-2013 Shuxin Yang <shuxin.llvm@gmail.com> [GV] Remove dead code which is really difficult to decipher.

Actually it took me couple of hours trying to make sense of them and
only to find they are dead code. I guess the original author used
"allSingleSucc" to indicate if there are any critial edge emanating
from some blocks, and tried to perform code motion (actually speculation)
in the presence of these critical edges; but later on he/she changed mind
and decided to perform edge-splitting first.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180951 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a15e708b1b05cfb9d3d126e12f508e37adc25fdb 12-Mar-2013 Dan Gohman <dan433584@gmail.com> Change the order of the operands in patchAndReplaceAllUsesWith so
that they're more consistent with Value::replaceAllUsesWith.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8a8de9889d7030292d0256d91ff93e9230c025c1 12-Feb-2013 Dan Gohman <dan433584@gmail.com> Actually delete this code, since it's really not clear what it's
trying to do.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175014 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5f3c4a39109479e81238ce28e91e5dcc565f068c 12-Feb-2013 Dan Gohman <dan433584@gmail.com> Record PRE predecessors with a SmallVector instead of a DenseMap, and
avoid a second pred_iterator traversal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175001 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8c0d29fee988928d2ce439b7a5f772e1cda62060 12-Feb-2013 Dan Gohman <dan433584@gmail.com> When disabling PRE for a value is directly redundant with itself
(through a loop), don't continue to iterate through the reamining
predecessors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c73b96a99f0192cd0a64f6d9e20b6e92e1003366 12-Feb-2013 Dan Gohman <dan433584@gmail.com> Check that pointers are removed from maps before calling delete on the pointers,
for tidiness' sake.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174988 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
67cd669f7b046191646351ec7005bc1b26bb01c3 12-Feb-2013 Dan Gohman <dan433584@gmail.com> Minor code simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a070d2a0355c4993240b5206ebc1d517c151331d 31-Jan-2013 Dan Gohman <dan433584@gmail.com> Change GetPointerBaseWithConstantOffset's DataLayout argument from a
reference to a pointer, so that it can handle the case where DataLayout
is not available and behave conservatively.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0b8c9a80f20772c3793201ab5b251d3520b9cea3 02-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.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/Transforms/Scalar/GVN.cpp
d295c9729d04727666c84c4a184e8ce796dd9974 02-Nov-2012 Duncan Sands <baldrick@free.fr> Fix an obvious typo that causes an assertion failure when running
test/Transforms/GVN/rle.ll if the (currently disabled) check for a
pointer type in getIntPtrType is turned on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167285 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7ed4f94c1337b931524af99eb1aac72563888239 29-Oct-2012 Duncan Sands <baldrick@free.fr> Remove a wrapper around getIntPtrType added to GVN by Hal in commit 166624 (the
wrapper returns a vector of integers when passed a vector of pointers) by having
getIntPtrType itself return a vector of integers in this case. Outside of this
wrapper, I didn't find anywhere in the codebase that was relying on the old
behaviour for vectors of pointers, so give this a whirl through the buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
aacb68806f4cb05b0b8102a188726e5b13f2a759 24-Oct-2012 Hal Finkel <hfinkel@anl.gov> Update GVN to support vectors of pointers.

GVN will now generate ptrtoint instructions for vectors of pointers.
Fixes PR14166.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166624 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
aa76e9e2cf50af190de90bc778b7f7e42ef9ceff 24-Oct-2012 Micah Villmow <villmow@gmail.com> Add in support for getIntPtrType to get the pointer type based on the address space.
This checkin also adds in some tests that utilize these paths and updates some of the
clients.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3574eca1b02600bac4e625297f4ecf745f4c4f32 08-Oct-2012 Micah Villmow <villmow@gmail.com> Move TargetData to DataLayout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165402 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
286c4dc355b8be6806081b23c3097485821c7642 12-Sep-2012 Manman Ren <mren@apple.com> Release build: guard dump functions with
"#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)"

No functional change. Update r163344.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
35aec959e9caa97147231f61f952ab166d993b1b 10-Sep-2012 Nick Lewycky <nicholas@mxc.ca> Move spaces to the right places. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163485 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
cc77eece74c8db09acc2af425e7e6c88a5bb30d1 06-Sep-2012 Manman Ren <mren@apple.com> Release build: guard dump functions with "ifndef NDEBUG"

No functional change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8e0d1c03ca7fd86e6879b4e37d0d7f0e982feef6 29-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> Make MemoryBuiltins aware of TargetLibraryInfo.

This disables malloc-specific optimization when -fno-builtin (or -ffreestanding)
is specified. This has been a problem for a long time but became more severe
with the recent memory builtin improvements.

Since the memory builtin functions are used everywhere, this required passing
TLI in many places. This means that functions that now have an optional TLI
argument, like RecursivelyDeleteTriviallyDeadFunctions, won't remove dead
mallocs anymore if the TLI argument is missing. I've updated most passes to do
the right thing.

Fixes PR13694 and probably others.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162841 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
bd7684c94c81226d550eff5dfe6aacb285a72f60 24-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> GVN: Fix quadratic runtime on the number of switch cases.

No intended behavior change. This was introduced in r162023. With the fixed
algorithm a Release build of ARMInstPrinter.cpp goes from 16s to 10s on a
2011 MBP.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
05130597262f3ed00dc4881d64795d117c76e3fc 16-Aug-2012 Rafael Espindola <rafael.espindola@gmail.com> Teach GVN to reason about edges dominating uses. This allows it to handle cases
where some fact lake a=b dominates a use in a phi, but doesn't dominate the
basic block itself.

This feature could also be implemented by splitting critical edges, but at least
with the current algorithm reasoning about the dominance directly is faster.

The time for running "opt -O2" in the testcase in pr10584 is 1.003 times slower
and on gcc as a single file it is 1.0007 times faster.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162023 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
f433e800a7fc3a760cbb4264f578e88df02074c6 10-Aug-2012 Rafael Espindola <rafael.espindola@gmail.com> Constify some basic blocks, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161668 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a94d6e87c4c49f2e81b01d66d8bfb591277f8f96 24-Jul-2012 Nadav Rotem <nadav.rotem@intel.com> Clean whitespaces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160668 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
06cb8ed00696eb14d1b831921452e50ec0568ea2 29-Jun-2012 Chandler Carruth <chandlerc@gmail.com> Move llvm/Support/IRBuilder.h -> llvm/IRBuilder.h

This was always part of the VMCore library out of necessity -- it deals
entirely in the IR. The .cpp file in fact was already part of the VMCore
library. This is just a mechanical move.

I've tried to go through and re-apply the coding standard's preferred
header sort, but at 40-ish files, I may have gotten some wrong. Please
let me know if so.

I'll be committing the corresponding updates to Clang and Polly, and
Duncan has DragonEgg.

Thanks to Bill and Eric for giving the green light for this bit of cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159421 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9e72a79ef4a9fcda482ce0b0e1f0bd6a4f16cffd 21-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> refactor the MemoryBuiltin analysis:
- provide more extensive set of functions to detect library allocation functions (e.g., malloc, calloc, strdup, etc)
- provide an API to compute the size and offset of an object pointed by

Move a few clients (GVN, AA, instcombine, ...) to the new API.
This implementation is a lot more aggressive than each of the custom implementations being replaced.

Patch reviewed by Nick Lewycky and Chandler Carruth, thanks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158919 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7b4ff9343d911a1b9c76c512787beb7a45f8270d 16-Jun-2012 Hal Finkel <hfinkel@anl.gov> Move the Metadata merging methods from GVN and make them public in MDNode.

There are other passes, BBVectorize specifically, that also need some of
this functionality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
06c6791742dfdd54b51441589e1c0921f9851675 05-Jun-2012 Rafael Espindola <rafael.espindola@gmail.com> When gvn decides to replace an instruction with another, we have to patch the
replacement to make it at least as generic as the instruction being replaced.
This includes:
* dropping nsw/nuw flags
* getting the least restrictive tbaa and fpmath metadata
* merging ranges

Fixes PR12979.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157958 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5cdbb1de7d9ca578330b35b7fb7b10296216316b 22-May-2012 Duncan Sands <baldrick@free.fr> Fix PR12858, a crash due to GVN's PRE not fully removing an instruction from the
leader table. That's because it wasn't expecting instructions to turn up as
leader for a value number that is not its own, but equality propagation could
create this situation. One solution is to have the leader table use a WeakVH
but this slows down GVN by about 5%. Instead just have equality propagation not
add instructions to the leader table, only constants and arguments. In theory
this might cause GVN to run more (each time it changes something it runs again)
but it doesn't seem to occur enough to cause a slow down.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157251 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
f6d55df9ecac7f4e3e654b7074729100f6de28ae 27-Apr-2012 David Blaikie <dblaikie@gmail.com> Change recurse depth limit to uint32 to fix warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155727 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5dde20bfacdad9bc3ddc99eff93d52ed54312ed9 27-Apr-2012 Mon P Wang <wangmp@apple.com> Add an early bailout to IsValueFullyAvailableInBlock from deeply nested blocks.
The limit is set to an arbitrary 1000 recursion depth to avoid stack overflow
issues. <rdar://problem/11286839>.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a28bd85aa9f540cb99be980e92d7c73e3fe96e6e 06-Apr-2012 Duncan Sands <baldrick@free.fr> Make GVN's propagateEquality non-recursive. No intended functionality change.
The modifications are a lot more trivial than they appear to be in the diff!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154174 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
41e2073f623a08504e2e1e5a9fc5c9f22a03eb83 29-Mar-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Don't PRE compares.

CodeGenPrepare sinks compare instructions down to their uses to prevent
live flags and predicate registers across basic blocks.

PRE of a compare instruction prevents that, forcing the i1 compare
result into a general purpose register. That is usually more expensive
than the redundant compare PRE was trying to eliminate in the first
place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153657 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e959f7e17f0bb999ab032b1567600d39347e983a 23-Mar-2012 Duncan Sands <baldrick@free.fr> When propagating equalities, eg replacing A with B in every basic block
dominated by Root, check that B is available throughout the scope. This
is obviously true (famous last words?) given the current logic, but the
check may be helpful if more complicated reasoning is added one day.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3d3abe0852d5f499bed7ab014519dd582a0a795d 11-Mar-2012 Stepan Dyatkovskiy <stpworld@narod.ru> llvm::SwitchInst
Renamed methods caseBegin, caseEnd and caseDefault with case_begin, case_end, and case_default.
Added some notes relative to case iterators.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152532 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c10fa6c801e48771b5eade50afc2fe6abaf08227 08-Mar-2012 Stepan Dyatkovskiy <stpworld@narod.ru> Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html

Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*".

ConstCaseIt is just a read-only iterator.
CaseIt is read-write iterator; it allows to change case successor and case value.

Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters.

Main way of iterator usage looks like this:
SwitchInst *SI = ... // intialize it somehow

for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) {
BasicBlock *BB = i.getCaseSuccessor();
ConstantInt *V = i.getCaseValue();
// Do something.
}

If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method.
If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method.

There are also related changes in llvm-clients: klee and clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152297 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8d12f72c11e4c1eda3918d20c95b83a1b00bae28 05-Mar-2012 Duncan Sands <baldrick@free.fr> This is not a common case, in fact it never happens!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152027 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
16003d0c0c20256dc02d0a922d41ad0c7e9c726c 05-Mar-2012 Chandler Carruth <chandlerc@gmail.com> Replace the ad-hoc hashing in GVN with the new hashing infrastructure.
This implicitly fixes a nasty bug in the GVN hashing (that thankfully
could only manifest as a performance bug): actually include the opcode
in the hash. The old code started the hash off with the opcode, but then
overwrote it with the type pointer.

Since this is likely to be pretty hot (GVN being already pretty
expensive) I've included a micro-optimization to just not bother with
the varargs hashing if they aren't present. I can't measure any change
in GVN performance due to this, even with a big test case like Duncan's
sqlite one. Everything I see is in the noise floor. That said, this
closes a loop hole for a potential scaling problem due to collisions if
the opcode were the differentiating aspect of the expression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152025 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
190e5a3314808fc126f18119315ce986d0689089 04-Mar-2012 Duncan Sands <baldrick@free.fr> Nick pointed out on IRC that GVN's propagateEquality wasn't propagating
equalities into phi node operands for which the equality is known to
hold in the incoming basic block. That's because replaceAllDominatedUsesWith
wasn't handling phi nodes correctly in general (that this didn't give wrong
results was just luck: the specific way GVN uses replaceAllDominatedUsesWith
precluded wrong changes to phi nodes).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2b4f4910458f9bfd15315444ed47b4f41473a93d 29-Feb-2012 Duncan Sands <baldrick@free.fr> Have GVN also do condition propagation when the right-hand side is not
a constant. This fixes PR1768.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151713 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
768ada611b78fe8143f5655f5a5c804b2a9768da 27-Feb-2012 Duncan Sands <baldrick@free.fr> Micro-optimization, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151524 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5583e30818255281dc3b2122ec7207bf68b449ae 27-Feb-2012 Duncan Sands <baldrick@free.fr> The value numbering function is recursive, so it is possible for multiple new
value numbers to be assigned when calculating any particular value number.
Enhance the logic that detects new value numbers to take this into account,
for a tiny compile time speedup. Fix a comment typo while there.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151522 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
669011f50b8234bb4775d52a2d1e1ba5f6311e62 27-Feb-2012 Duncan Sands <baldrick@free.fr> When performing a conditional branch depending on the value of a comparison
%cmp (eg: A==B) we already replace %cmp with "true" under the true edge, and
with "false" under the false edge. This change enhances this to replace the
negated compare (A!=B) with "false" under the true edge and "true" under the
false edge. Reported to improve perlbench results by 1%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151517 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e170c76ccdcf9b0343d2d5a2805010ff77b8b56e 24-Feb-2012 Duncan Sands <baldrick@free.fr> Teach GVN that x+y is the same as y+x and that x<y is the same as y>x.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151365 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8c160548ce58c87242335b041f80e1b97f974823 08-Feb-2012 Duncan Sands <baldrick@free.fr> Use Use::set rather than finding the operand number of the use
and setting that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150074 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c4fd448712a70a414bcf05d74f77416407ae42c2 05-Feb-2012 Duncan Sands <baldrick@free.fr> Neaten up this method. Check that if there is only one
predecessor then it's Src.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149843 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
87ba3f122b0203cf71e10c5e48d2d35beb3b0fc3 05-Feb-2012 Duncan Sands <baldrick@free.fr> Fix a thinko pointed out by Eli and the buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149839 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
33756f96d75e20d336f404debf701e8d6b4ecfc8 05-Feb-2012 Duncan Sands <baldrick@free.fr> Reduce the number of dom queries made by GVN's conditional propagation
logic by half: isOnlyReachableViaThisEdge was trying to be clever and
handle the case of a branch to a basic block which is contained in a
loop. This costs a domtree lookup and is completely useless due to
GVN's position in the pass pipeline: all loops have preheaders at this
point, which means it is enough for isOnlyReachableViaThisEdge to check
that Dst has only one predecessor. (I checked this theoretical argument
by running over the entire nightly testsuite, and indeed it is so!).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149838 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
68e20223a7260b5978dc85af6fea647be4c6a5f9 05-Feb-2012 Duncan Sands <baldrick@free.fr> Reduce the number of non-trivial domtree queries by about 1% when
compiling sqlite3, by only doing dom queries after the cheap check
rather than interleaved with it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149836 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
24473120a253a05f3601cd3373403b47e6d03d41 01-Feb-2012 Stepan Dyatkovskiy <stpworld@narod.ru> SwitchInst refactoring.
The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.

What was done:

1. Changed semantics of index inside the getCaseValue method:
getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous.
2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned.
3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment.
4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst.
4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor.
4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.

Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149481 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b319f127274291a2f58e1f2a146f4e5a274f1e10 31-Jan-2012 Bill Wendling <isanbard@gmail.com> Increase the initial vector size to be equivalent to the size of the Deps
vector. This potentially saves a resizing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149369 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5d8ab0f02b3af1a19b46ccc6aa4782451e9dab8b 31-Jan-2012 Bill Wendling <isanbard@gmail.com> Cache the size of the vector instead of calling .size() all over the place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0cf6b99b963e3b269b37f73558ac2f34482f835e 30-Jan-2012 Chad Rosier <mcrosier@apple.com> Typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
431985a421bf2b4327322f256e9cf74df1239c7b 30-Jan-2012 Chad Rosier <mcrosier@apple.com> Typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149275 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
618c1dbd293d15ee19f61b1156ab8086ad28311a 01-Dec-2011 Chad Rosier <mcrosier@apple.com> Propagate TargetLibraryInfo throughout ConstantFolding.cpp and
InstructionSimplify.cpp. Other fixups as needed.
Part of rdar://10500969

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1673b15da2d908e0ea9fd2d64f61d6d226cfe16e 15-Oct-2011 Duncan Sands <baldrick@free.fr> Don't replace all dominated uses if there is only one use, since that
use can't be dominated, saving one domtree lookup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142066 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b414142036012dd9432c4e8c5fef09d4d49fcc22 14-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Enhance the memdep interface so that users can tell the difference between a dependency which cannot be calculated and a path reaching the entry point of the function. This patch introduces isNonFuncLocal, which replaces isUnknown in some cases.

Patch by Xiaoyi Guo.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141896 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3f329cb781492e19a72af267cd3b7c2d8307a818 07-Oct-2011 Duncan Sands <baldrick@free.fr> Teach GVN to also propagate switch cases. For example, in this code
switch (n) {
case 27:
do_something(x);
...
}
the call do_something(x) will be replaced with do_something(27). In
gcc-as-one-big-file this results in the removal of about 500 lines of
bitcode (about 0.02%), so has about 1/10 of the effect of propagating
branch conditions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141360 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
02b5e72ac6ec1fe81e1f73f85be436faa078eabf 05-Oct-2011 Duncan Sands <baldrick@free.fr> GVN does simple propagation of conditions: when it sees a conditional
branch "br i1 %x, label %if_true, label %if_false" then it replaces
"%x" with "true" in places only reachable via the %if_true arm, and
with "false" in places only reachable via the %if_false arm. Except
that actually it doesn't: if value numbering shows that %y is equal
to %x then, yes, %y will be turned into true/false in this way, but
any occurrences of %x itself are not transformed. Fix this. What's
more, it's often the case that %x is an equality comparison such as
"%x = icmp eq %A, 0", in which case every occurrence of %A that is
only reachable via the %if_true arm can be replaced with 0. Implement
this and a few other variations on this theme. This reduces the number
of lines of LLVM IR in "GCC as one big file" by 0.2%. It has a bigger
impact on Ada code, typically reducing the number of lines of bitcode
by around 0.4% by removing repeated compiler generated checks. Passes
the LLVM nightly testsuite and the Ada ACATS testsuite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141177 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
452c58f4c45249b5046f74a165430eedaab5f8f6 05-Oct-2011 Duncan Sands <baldrick@free.fr> Generalize GVN's conditional propagation logic slightly:
it's OK for the false/true destination to have multiple
predecessors as long as the extra ones are dominated by
the branch destination.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141176 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a9390a4d5f5d568059a80970d22194b165d097a7 27-Sep-2011 Benjamin Kramer <benny.kra@googlemail.com> Stop emitting instructions with the name "tmp" they eat up memory and have to be uniqued, without any benefit.

If someone prefers %tmp42 to %42, run instnamer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8cec759339f69ff6479e50c13545db3a5337c71a 02-Sep-2011 Jakub Staszak <jstaszak@apple.com> Compare type size instead of type _store_ size to make sure that BitCastInst
will be valid. This fixes PR10820.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139005 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
56efe24431b045be120d1fd5f6b0aa43a6b01c48 18-Aug-2011 Eli Friedman <eli.friedman@gmail.com> Atomic load/store handling for the passes using memdep (GVN, DSE, memcpyopt).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137888 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
795cf5efba4255cadd0bfde0e9d3dec65e96dd50 17-Aug-2011 Bill Wendling <isanbard@gmail.com> Disable PRE for landing pads.

PRE needs the landing pads to have their critical edges split. Doing this for a
landing pad is non-trivial. Abandon the attempt to perform PRE when we come
across a landing pad. (Reviewed by Owen!)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137876 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
dab3d29605a5c83db41b28176273ef55961120c1 21-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert ConstantExpr::getGetElementPtr and
ConstantExpr::getInBoundsGetElementPtr to use ArrayRef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
db125cfaf57cc83e7dd7453de2d509bc8efd0e5e 18-Jul-2011 Chris Lattner <sabre@nondot.org> land David Blaikie's patch to de-constify Type, with a few tweaks.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
bd1828c6ed8e699dc3efe69271e58085f35a5db3 09-Jul-2011 Lang Hames <lhames@gmail.com> Added recognition for signed add/sub/mul with overflow intrinsics to GVN as per Chris and Frits suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134777 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1fb0955cab05ff71f5bbad523b0374db3b08b201 08-Jul-2011 Lang Hames <lhames@gmail.com> Make GVN look through extractvalues for recognised intrinsics. GVN can then CSE ops that match values produced by the intrinsics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134677 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c137120bb047a7017cbab21f5f9c9e6f65e2b84f 20-Jun-2011 Jay Foad <jay.foad@gmail.com> Make better use of the PHINode API.

Change various bits of code to make better use of the existing PHINode
API, to insulate them from forthcoming changes in how PHINodes store
their operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133434 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a990e071f2f29ba326b97a4288207a2c406c5b66 15-Jun-2011 Eli Friedman <eli.friedman@gmail.com> Add "unknown" results for memdep, which mean "I don't know whether a dependence for the given instruction exists in the given block". This cleans up all the existing hacks in memdep which represent this concept by returning clobber with various unrelated instructions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133031 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9e7bc05ad7fb69a25aff37e348942b07eed9cd73 22-May-2011 Chris Lattner <sabre@nondot.org> fix PR9841 by having GVN not process dead loads. This was
causing it to get into infinite loops when it would widen a
load (which can necessarily leave around dead loads).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131847 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
de98568bf8adfbfd3c7437c7cdfa617efc7147f3 17-May-2011 Devang Patel <dpatel@apple.com> Preserve line number information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131482 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
d9b4996637a85e0bb42e7d763c7656c063a6ec83 17-May-2011 Devang Patel <dpatel@apple.com> Set debug loc for new load instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131481 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0f18d97fd16a4735817327e58222eca717aa8271 05-May-2011 Devang Patel <dpatel@apple.com> Set debug loc for new instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130895 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1e4f44bb8aa363960f6f4018fc1dd11d8c39aae5 28-Apr-2011 Chris Lattner <sabre@nondot.org> improve comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130426 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0a9e3d613bbbd8c47f4edf6841f566fa22775932 28-Apr-2011 Chris Lattner <sabre@nondot.org> final step needed to resolve PR6627, which allows us to flatten the code down to
a nice and tidy:
%x1 = load i32* %0, align 4
%1 = icmp eq i32 %x1, 1179403647
br i1 %1, label %if.then, label %if.end

instead of doing lots of loads and branches. May the FreeBSD bootloader
long fit in its allocated space.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130416 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
ad3ba6a7de5eb24ea58ba0ec9dd1e41912f678a9 28-Apr-2011 Chris Lattner <sabre@nondot.org> code cleanups only.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130414 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4756ecb375725cca9d374bde389977325075c9eb 28-Apr-2011 Chris Lattner <sabre@nondot.org> centralize "marking for deletion" into a helper function. Pass GVN around to
static functions instead of passing around tons of random ivars.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
f07054d98a5fcd59f3a30853f4b54a74a74986e5 28-Apr-2011 Chris Lattner <sabre@nondot.org> Promote toErase to be an ivar of the GVN class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130401 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4034e14985af013f71f7884fa275415a3be27778 28-Apr-2011 Chris Lattner <sabre@nondot.org> teach GVN to widen integer loads when they are overaligned, when doing an
wider load would allow elimination of subsequent loads, and when the wider
load is still a native integer type. This eliminates a ton of loads on
various benchmarks involving struct fields, though it is somewhat hobbled
by clang not being very aggressive about field alignment.

This is yet another step along the way towards resolving PR6627.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130390 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9750acc079409e52f6563636a112a9de50749b30 26-Apr-2011 Chris Lattner <sabre@nondot.org> Improve the bail-out predicate to really only kick in when phi
translation fails. We were bailing out in some cases that would
cause us to miss GVN'ing some non-local cases away.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130206 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1f821512fc1441480b3355305e0da5267073fe1c 26-Apr-2011 Chris Lattner <sabre@nondot.org> Enhance MemDep: When alias analysis returns a partial alias result,
return it as a clobber. This allows GVN to do smart things.

Enhance GVN to be smart about the case when a small load is clobbered
by a larger overlapping load. In this case, forward the value. This
allows us to compile stuff like this:

int test(void *P) {
int tmp = *(unsigned int*)P;
return tmp+*((unsigned char*)P+1);
}

into:

_test: ## @test
movl (%rdi), %ecx
movzbl %ch, %eax
addl %ecx, %eax
ret

which has one load. We already handled the case where the smaller
load was from a must-aliased base pointer.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130180 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3ecfc861b4365f341c5c969b40e1afccde676e6f 30-Mar-2011 Jay Foad <jay.foad@gmail.com> Remove PHINode::reserveOperandSpace(). Instead, add a parameter to
PHINode::Create() giving the (known or expected) number of operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
d8b4fb4aab4d6fedb2b14bed1b846451b17bde7c 30-Mar-2011 Jay Foad <jay.foad@gmail.com> (Almost) always call reserveOperandSpace() on newly created PHINodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128535 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
bd1801b5553c8be3960255a92738464e0010b6f6 24-Jan-2011 Dan Gohman <gohman@apple.com> Give GetUnderlyingObject a TargetData, to keep it in sync
with BasicAA's DecomposeGEPExpression, which recently began
using a TargetData. This fixes PR8968, though the testcase
is awkward to reduce.

Also, update several off GetUnderlyingObject's users
which happen to have a TargetData handy to pass it in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124134 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
89f1582616a4f01a7f230fd97337e13c317f5d35 11-Jan-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Remove the PR8954 workaround.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123288 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
d8c120bbd3ed19439c02ce629f312b163302b5dd 11-Jan-2011 Cameron Zwarich <zwarich@apple.com> Dial back the speculative fix for PR8954 a bit, so that we only recompute dominators
once at the beginning of GVN instead of once per iteration.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123278 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e641863cd2e28e6a1f0f41446bef08f89a22a513 11-Jan-2011 Cameron Zwarich <zwarich@apple.com> Attempt to fix the bootstrap buildbot. Rafael says this works for him on x86-64 Linux.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123270 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3077ca97bdd4de7e8878e2f8308b6f615b60a470 11-Jan-2011 Chris Lattner <sabre@nondot.org> update memdep when an instruction is deleted. This code isn't
actually reached in the testcase in PR8954, but it's safe and good
practice.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123224 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b5b7997fd0765f73b711ea4c72e4433ce3637794 11-Jan-2011 Chris Lattner <sabre@nondot.org> Fix FoldSingleEntryPHINodes to update memdep and AA when it deletes
phi nodes. It is called from MergeBlockIntoPredecessor which is
called from GVN, which claims to preserve these.

I'm skeptical that this is the actual problem behind PR8954, but
this is a stab in the right direction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123222 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2cf7537dc6ca7ad69e5f3a70b5b26cc5fa0cff64 04-Jan-2011 Owen Anderson <resistor@mac.com> Don't bother value numbering instructions with void types in GVN. In theory this should allow us to insert
fewer things into the value numbering maps, but any speedup is beneath the noise threshold on my machine
on 403.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122844 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b1602abe636cb5c1e288de2e133cab026882e12c 04-Jan-2011 Owen Anderson <resistor@mac.com> Complete the NumberTable --> LeaderTable rename.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122828 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a0709acd6fd132fd81f3cc86e98240cb6ad11b05 04-Jan-2011 Owen Anderson <resistor@mac.com> Fix typo in a comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122827 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
465942d0085a2d20bcd2028bd1e54bde1ac73385 04-Jan-2011 Owen Anderson <resistor@mac.com> Prune #include's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122826 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7a75d6108ea19f5fb64d5fa964bb43315207d34d 04-Jan-2011 Owen Anderson <resistor@mac.com> Clarify terminology, settling on referring to what was the "number table" as the "leader table", and
rename methods to make it much more clear what they're doing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122823 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
680ac4ff4e9434a694d3f72c44f3f2d063a7cb15 04-Jan-2011 Owen Anderson <resistor@mac.com> When removing a value from GVN's leaders list, don't drop the Next pointer in a corner case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122822 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c2146a6abc6366ed6171c555d771bc6cb657f31a 04-Jan-2011 Owen Anderson <resistor@mac.com> Branch instructions don't produce values, so there's no need to generate a value number for them. This
avoids adding them to the various value numbering tables, resulting in a minor (~3%) speedup for GVN
on 40.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122819 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2802c7536f1f52a4028f8ba7c5406c2120f899b5 04-Jan-2011 Owen Anderson <resistor@mac.com> Remove commented out code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122817 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
392249fcf368a22f48091a16c180160221c7e89a 04-Jan-2011 Owen Anderson <resistor@mac.com> Use the new addEscapingValue callback to update GlobalsModRef when GVN adds PHIs of GEPs. For the moment,
have GlobalsModRef handle this conservatively by simply removing the value from its maps.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122787 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
30f4a559d71b2382e3c74be2b9bfd9dd575d960a 03-Jan-2011 Owen Anderson <resistor@mac.com> Simplify GVN's value expression structure, allowing the elimination of a lot of
almost-but-not-quite-identical code. No intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122760 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9fc5cdf77c812aaa80419036de27576d45894d0d 02-Jan-2011 Chris Lattner <sabre@nondot.org> split dom frontier handling stuff out to its own DominanceFrontier header,
so that Dominators.h is *just* domtree. Also prune #includes a bit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122714 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
f0568389563d46a7252ce8a17ef316e313cc17c6 22-Dec-2010 Owen Anderson <resistor@mac.com> Give GVN back the ability to perform simple conditional propagation on conditional branch values.
I still think that LVI should be handling this, but that capability is some ways off in the future,
and this matters for some significant benchmarks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
491e0307a8bca870d9de03962204b03286b106f7 21-Dec-2010 Owen Anderson <resistor@mac.com> Remove dead code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122371 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
aad94aa4375d5ed43be728e03d91751c102ff958 21-Dec-2010 Benjamin Kramer <benny.kra@googlemail.com> GVN's Expression is not POD-like (it contains a SmallVector). Simplify code while at it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122362 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
459f4f8c25bd0f61b76b61b19f4839e5790fad34 19-Dec-2010 Chris Lattner <sabre@nondot.org> tidy up


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122190 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
f4177aa0193d9bedc4f919b9322464bf3dee83ab 16-Dec-2010 Dan Gohman <gohman@apple.com> Preserve TBAA tags when doing load PRE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121921 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5034dd318a9dfa0dc45a3ac01e58e60f2aa2498d 15-Dec-2010 Dan Gohman <gohman@apple.com> Move Value::getUnderlyingObject to be a standalone
function so that it can live in Analysis instead of
VMCore.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
ed58a6f96f605901adc0df3ca76499d52b2d1a1a 30-Nov-2010 Chris Lattner <sabre@nondot.org> move GetPointerBaseWithConstantOffset out of GVN into ValueTracking.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120476 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
fcf8d7c73d7517e26f9f9d1a9af22ad4314e4984 30-Nov-2010 Chris Lattner <sabre@nondot.org> remove a fixed fixme


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120474 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
68c26396c07b4ad96657d4510f06f7646785278d 19-Nov-2010 Owen Anderson <resistor@mac.com> Document the new GVN number table structure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119865 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a04a0649e13dc97c778856a85717b3e9428786f0 18-Nov-2010 Owen Anderson <resistor@mac.com> Completely rework the datastructure GVN uses to represent the value number to leader mapping. Previously,
this was a tree of hashtables, and a query recursed into the table for the immediate dominator ad infinitum
if the initial lookup failed. This led to really bad performance on tall, narrow CFGs.

We can instead replace it with what is conceptually a multimap of value numbers to leaders (actually
represented by a hashtable with a list of Value*'s as the value type), and then
determine which leader from that set to use very cheaply thanks to the DFS numberings maintained by
DominatorTree. Because there are typically few duplicates of a given value, this scan tends to be
quite fast. Additionally, we use a custom linked list and BumpPtr allocation to avoid any unnecessary
allocation in representing the value-side of the multimap.

This change brings with it a 15% (!) improvement in the total running time of GVN on 403.gcc, which I
think is pretty good considering that includes all the "real work" being done by MemDep as well.

The one downside to this approach is that we can no longer use GVN to perform simple conditional progation,
but that seems like an acceptable loss since we now have LVI and CorrelatedValuePropagation to pick up
the slack. If you see conditional propagation that's not happening, please file bugs against LVI or CVP.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119714 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
d32c4a1756b3c236b7f96cf11ba61e78ceb862bc 17-Nov-2010 Duncan Sands <baldrick@free.fr> Remove dead code in GVN: now that SimplifyInstruction is called
systematically, CollapsePhi will always return null here. Note
that CollapsePhi did an extra check, isSafeReplacement, which
the SimplifyInstruction logic does not do. I think that check
was bogus - I guess we will soon find out! (It was originally
added in commit 41998 without a testcase).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119456 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
eff0581583ef10e2872e9baf537a04b67d992101 14-Nov-2010 Duncan Sands <baldrick@free.fr> If dom tree information is available, make it possible to pass
it to get better phi node simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
88c3df7afb8e067daab12dbbbc9ce898a52e9624 12-Nov-2010 Duncan Sands <baldrick@free.fr> Have GVN simplify instructions as it goes. For example, consider
"%z = %x and %y". If GVN can prove that %y equals %x, then it turns
this into "%z = %x and %x". With the new code, %z will be replaced
with %x everywhere (and then deleted). Previously %z would be value
numbered too, which is a waste of time. Also, while a clever value
numbering algorithm would give %z the same value number as %x, our
current one doesn't do so (at least I don't think it does). The new
logic has an essentially equivalent effect to what you would get if
%z was given the same value number as %x, i.e. it should make value
numbering smarter. While there, get hold of target data once at the
start rather than a gazillion times all over the place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118923 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
6d8eb156e6be727570b300bac7712f745a318c7d 11-Nov-2010 Dan Gohman <gohman@apple.com> Add helper functions for computing the Location of load, store,
and vaarg instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118845 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
075fb5d68fcb55d26e44c48f07dfdbbfa21ccb2a 10-Nov-2010 Dan Gohman <gohman@apple.com> Enhance GVN to do more precise alias queries for non-local memory
references. For example, this allows gvn to eliminate the load in
this example:

void foo(int n, int* p, int *q) {
p[0] = 0;
p[1] = 1;
if (n) {
*q = p[0];
}
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118714 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3355c4e5986571da8f16fca060941e4020a4447b 10-Nov-2010 Dan Gohman <gohman@apple.com> Use getValueOperand() and getPointerOperand() on load and store
instructions instead of hard-coding operand numbers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.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/Transforms/Scalar/GVN.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/Transforms/Scalar/GVN.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/Transforms/Scalar/GVN.cpp
7267e14327b269bd15dd9cc8083f68bef577b585 01-Oct-2010 Owen Anderson <resistor@mac.com> Now that the profitable bits of EnableFullLoadPRE have been enabled by default, rip out the remainder.
Anyone interested in more general PRE would be better served by implementing it separately, to get real
anticipation calculation, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115337 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
722cc1f41413530e15a46eb940ce68330647ff27 30-Sep-2010 Owen Anderson <resistor@mac.com> We do want to allow LoadPRE to perform LICM-like transformations: we already consider PHI nodes to be negligible for
code size (making this transform code size neutral), and it allows us to hoist values out of loops, which is always
a good thing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115205 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b0ba0f4170dcfe1dbce17680c16cffce311e3ad8 25-Sep-2010 Owen Anderson <resistor@mac.com> LoadPRE was not properly checking that the load it was PRE'ing post-dominated the block it was being hoisted to.
Splitting critical edges at the merge point only addressed part of the issue; it is also possible for non-post-domination
to occur when the path from the load to the merge has branches in it. Unfortunately, full anticipation analysis is
time-consuming, so for now approximate it. This is strictly more conservative than real anticipation, so we will miss
some cases that real PRE would allow, but we also no longer insert loads into paths where they didn't exist before. :-)

This is a very slight net positive on SPEC for me (0.5% on average). Most of the benchmarks are largely unaffected, but
when it pays off it pays off decently: 181.mcf improves by 4.5% on my machine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114785 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
17aa68055beed6faa48ca3a995c5b6fdf5092fd4 04-Sep-2010 Chris Lattner <sabre@nondot.org> zap dead code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113073 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
fc6e29d4ab52b7d3efd83846ed495a9ca7e51e49 02-Sep-2010 Duncan Sands <baldrick@free.fr> Reapply commit 112699, speculatively reverted by echristo, since
I'm sure it is harmless. Original commit message:
If PrototypeValue is erased in the middle of using the SSAUpdator
then the SSAUpdator may access freed memory. Instead, simply pass
in the type and name explicitly, which is all that was used anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112810 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
adc581f5cb6bdb929b1c6a155c330151ebd3bf72 01-Sep-2010 Eric Christopher <echristo@apple.com> Speculatively revert 112699 and 112702, they seem to be causing
self host errors on clang-x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112719 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4d588bceb035589ade874f432d70a41bb7ec6273 01-Sep-2010 Duncan Sands <baldrick@free.fr> If PrototypeValue is erased in the middle of using the SSAUpdator
then the SSAUpdator may access freed memory. Instead, simply pass
in the type and name explicitly, which is all that was used anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112699 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
abd2a7590061019c95b2f325f813bbea9bb79924 29-Aug-2010 Chris Lattner <sabre@nondot.org> remove dead proto


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112408 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5015b3417fcf5b415fa9a1e5b111ea6f8e96fbfa 07-Aug-2010 Owen Anderson <resistor@mac.com> Don't attempt the PRE inline asm calls, since we don't value number them yet. Fixes PR7835.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110489 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.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/Transforms/Scalar/GVN.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/Transforms/Scalar/GVN.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/Transforms/Scalar/GVN.cpp
96f1d8ebdd33b3f9bdb3b1163f36072c68599f42 22-Jul-2010 Gabor Greif <ggreif@gmail.com> mass elimination of reliance on automatic iterator dereferencing

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109103 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.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/Transforms/Scalar/GVN.cpp
1d3ae029c4f2a643df9ea9d0ed7c874a086d0ef2 09-Jul-2010 Gabor Greif <ggreif@gmail.com> cache result of operator* (found by inspection)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107971 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
08149858879a933d8b981091fbf4822fe55513bc 09-Jul-2010 Gabor Greif <ggreif@gmail.com> cache result of operator*

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107969 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
237e1da16ac539aec3b6b99ed8fb64f348b6e766 30-Jun-2010 Gabor Greif <ggreif@gmail.com> use getNumArgOperands instead of getNumOperands

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107272 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
d883a9d1ed7cca9674ba7055ec45bfe2b8cb6463 24-Jun-2010 Gabor Greif <ggreif@gmail.com> use ArgOperand API

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106730 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0a14be0693c8563055aedaed47c5773154327caf 24-Jun-2010 Gabor Greif <ggreif@gmail.com> use callsite to obtain all arguments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106729 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
fe60104ac97f3a8736dcfbfdf9547c7b7cc7b951 22-Jun-2010 Dan Gohman <gohman@apple.com> Use pre-increment instead of post-increment when the result is not used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
dd9344f3face8f1978a7f9f393c31b628144d1f6 28-May-2010 Dan Gohman <gohman@apple.com> Move FindAvailableLoadedValue isSafeToLoadUnconditionally out of
lib/Transforms/Utils and into lib/Analysis so that Analysis passes
can use them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7944c21cae06c5124cf1ee1f811d2a13f8e1b939 08-May-2010 Chris Lattner <sabre@nondot.org> Fix PR7052, patch by Jakub Staszak!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103347 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
bc786530574016bd34510fcea19d72a18d5405a9 05-May-2010 Bob Wilson <bob.wilson@apple.com> Use the right version of "append" to combine two SmallVectors.
This fixes the compile-time regressions seen in last night's tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103118 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
34414a634e0e98cc4c2e3a9c31f0e959884736b6 04-May-2010 Bob Wilson <bob.wilson@apple.com> Defer adding critical edges to the "toSplit" list until after checking for
indirect branches in all the predecessors. This avoids unnecessarily
splitting edges in cases where load PRE is not possible anyway.
Thanks to Jakub Staszak for pointing this out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103034 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
551754c4958086cc6910da7c950f2875e212f5cf 17-Apr-2010 Eric Christopher <echristo@apple.com> Revert 101465, it broke internal OpenGL testing.

Probably the best way to know that all getOperand() calls have been handled
is to replace that API instead of updating.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101579 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4ec2258ffb495d7ce00177e447740ef1123a27db 16-Apr-2010 Gabor Greif <ggreif@gmail.com> reapply r101434
with a fix for self-hosting

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
607a7ab3da72a2eb53553a520507cbb8068dd1d8 16-Apr-2010 Gabor Greif <ggreif@gmail.com> back out r101423 and r101397, they break llvm-gcc self-host on darwin10

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101434 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2ff961f66816daab8bbc58a19025161d969821c2 15-Apr-2010 Gabor Greif <ggreif@gmail.com> reapply r101364, which has been backed out in r101368
with a fix

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101397 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b35798347ea87b8b6d36155b211016a7769f01ab 15-Apr-2010 Dan Gohman <gohman@apple.com> Fix a bunch of namespace polution.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101376 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9ee17208115482441953127615231c59a2f4d052 15-Apr-2010 Gabor Greif <ggreif@gmail.com> back out r101364, as it trips the linux nightlybot on some clang C++ tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
165dac08d1bb8428b32a5f39cdd3dbee2888987f 15-Apr-2010 Gabor Greif <ggreif@gmail.com> rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
ea3eec9f8588a1fe0fe80324d1413ab165b675ca 09-Apr-2010 Gabor Greif <ggreif@gmail.com> const-ize a predicate

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100856 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
219d77430b3495091205249c1d5be51014616475 25-Mar-2010 Chris Lattner <sabre@nondot.org> fix PR6642, GVN forwarding from memset to load of the base of the memset.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99488 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3bd19d753baf13577a43e0375bd7283379ad914a 02-Mar-2010 Bob Wilson <bob.wilson@apple.com> Don't attempt load PRE when there is no real redundancy (i.e., the load is in
a loop and is itself the only dependency).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97526 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
70704978af7d37d7951c576ccb7b0cd17053b5a5 02-Mar-2010 Bob Wilson <bob.wilson@apple.com> When GVN needs to split critical edges for load PRE, check all of the
predecessors before returning. Otherwise, if multiple predecessor edges need
splitting, we only get one of them per iteration. This makes a small but
measurable compile time improvement with -enable-full-load-pre.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
19d417c346d5f49d86fe447cc58d931a1b476d8e 01-Mar-2010 Evan Cheng <evan.cheng@apple.com> MemoryDepAnalysis is not used if redundant load processing is disabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b29d7d25423bc91a06a8a16aee3ff0ea96980706 28-Feb-2010 Bob Wilson <bob.wilson@apple.com> Revert r97245 which seems to be causing performance problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8561dcd7306f4a4d45b1f2372e7cd40a753f2cc6 26-Feb-2010 Bob Wilson <bob.wilson@apple.com> Move the EnableFullLoadPRE flag from a separate command-line option to an
argument of createGVNPass and set it automatically for -O3.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97245 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
60df9077ebe2a38723beadedd88e349f9aa214cb 26-Feb-2010 Bob Wilson <bob.wilson@apple.com> Remove unused "NoPRE" parameter in GVN and createGVNPass().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97235 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
6d8f2ca646bc283c31f48b6816d5194c836dfec6 24-Feb-2010 Daniel Dunbar <daniel@zuster.org> Reapply r97010, the speculative revert failed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8c0c99016b4348bf9cc294a0f2dd60a219d4506c 24-Feb-2010 Daniel Dunbar <daniel@zuster.org> Speculatively revert r97010, "Add an argument to PHITranslateValue to specify
the DominatorTree. ...", in hopes of restoring poor old PPC bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97027 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9d2ed8e632b71914b2a668932f4f49b87c3ca0b1 24-Feb-2010 Bob Wilson <bob.wilson@apple.com> Add an argument to PHITranslateValue to specify the DominatorTree. If this
argument is non-null, pass it along to PHITranslateSubExpr so that it can
prefer using existing values that dominate the PredBB, instead of just
blindly picking the first equivalent value that it finds on a uselist.
Also when the DominatorTree is specified, have PHITranslateValue filter
out any result that does not dominate the PredBB. This is basically just
refactoring the check that used to be in GetAvailablePHITranslatedSubExpr
and also in GVN.

Despite my initial expectations, this change does not affect the results
of GVN for any testcases that I could find, but it should help compile time.
Before this change, if PHITranslateSubExpr picked a value that does not
dominate, PHITranslateWithInsertion would then insert a new value, which GVN
would later determine to be redundant and would replace. By picking a good
value to begin with, we save GVN the extra work of inserting and then
replacing a new value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97010 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
188f428e4e76d465ac89c275318521bdfbe028eb 23-Feb-2010 Bob Wilson <bob.wilson@apple.com> Update memdep when load PRE inserts a new load, and add some debug output.
I don't have a small testcase for this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96890 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
74175c2ca1d4c9180f5e46d362814b9f0a114536 22-Feb-2010 Bob Wilson <bob.wilson@apple.com> Erase deleted instructions from GVN's ValueTable. This fixes assertion
failures from ValueTable::verifyRemoved() when using -debug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96805 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
ae23daf63afccd68be965ff4f7acafa818d76aaa 16-Feb-2010 Bob Wilson <bob.wilson@apple.com> Rename SuccessorNumber to GetSuccessorNumber.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96387 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
484d4a30c055eef3101d01a7a468db3413dd20d3 16-Feb-2010 Bob Wilson <bob.wilson@apple.com> Split critical edges as needed for load PRE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
adb6f226714dcfae363f51b453c4590b0f42da5e 16-Feb-2010 Bob Wilson <bob.wilson@apple.com> Refactor to share code to find the position of a basic block successor in the
terminator's list of successors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96377 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1df9859c40492511b8aa4321eb76496005d3b75b 16-Feb-2010 Duncan Sands <baldrick@free.fr> There are two ways of checking for a given type, for example isa<PointerType>(T)
and T->isPointerTy(). Convert most instances of the first form to the second form.
Requested by Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
be905e26f66e1b34fa4b2f5744b948007fd4ed0a 11-Feb-2010 Devang Patel <dpatel@apple.com> Ignore dbg info intrinsics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95828 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e7b635f430a0732d2790ef747fe9b4d7582de8a5 03-Feb-2010 Bob Wilson <bob.wilson@apple.com> Fix some comment typos.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95170 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
6cad41778eeaf657f07000d41b4bb98597ed224a 01-Feb-2010 Bob Wilson <bob.wilson@apple.com> Add an option to GVN to remove all partially redundant loads. This is currently
disabled by default. This divides the existing load PRE code into 2 phases:
first it checks that it is safe to move the load to each of the predecessors
where it is unavailable, and then if it is safe, the code is changed to move
the load. Radar 7571861.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95007 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
49db68fba01722ca032dc5170f8248a9d25f0199 30-Jan-2010 Bob Wilson <bob.wilson@apple.com> Check alignment of loads when deciding whether it is safe to execute them
unconditionally. Besides checking the offset, also check that the underlying
object is aligned as much as the load itself.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94875 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3eb4f7e2dd98038f94e45d1c45ccff49e6659c87 29-Jan-2010 Bob Wilson <bob.wilson@apple.com> Improve isSafeToLoadUnconditionally to recognize that GEPs with constant
indices are safe if the result is known to be within the bounds of the
underlying object.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94829 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0988639963747a29fccf1273bbec996b4bac89a8 25-Jan-2010 Bob Wilson <bob.wilson@apple.com> Remove check for an impossible condition: the condition of the while loop has
already checked that TmpBB->getSinglePredecessor() is non-null.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94451 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a81e241fcc1effa9e82fcd7efdee5f6cacce1c7e 17-Jan-2010 Owen Anderson <resistor@mac.com> Convert some of the dynamic opcode lookups into static ones.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
321a813c536e2f1f2f05bbe78a7fbf64046f0557 05-Jan-2010 Dan Gohman <gohman@apple.com> Use do+while instead of while for loops which obviously have a
non-zero trip count. Use SmallVector's pop_back_val().


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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92613 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a53cfd16f075f22655a8c965b122aea38e635aa3 28-Dec-2009 Chris Lattner <sabre@nondot.org> split code that doesn't need to be templated out of IRBuilder into a new
non-templated IRBuilderBase class. Move that large CreateGlobalString
out of line, eliminating the need to #include GlobalVariable.h in IRBuilder.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92227 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0ee443d169786017d151034b8bd34225bc144c98 22-Dec-2009 Chris Lattner <sabre@nondot.org> The phi translated pointer can be computed when returning a partially cached result
instead of stored. This reduces memdep memory usage, and also eliminates a bunch of
weakvh's. This speeds up gvn on gcc.c-torture/20001226-1.c from 23.9s to 8.45s (2.8x)
on a different machine than earlier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
d2191e549b42eed97366b34e3b7a567b6a1208c2 22-Dec-2009 Chris Lattner <sabre@nondot.org> Add a fastpath to Load GVN to special case when we have exactly one dominating
load to avoid even messing around with SSAUpdate at all. In this case (which
is very common, we can just use the input value directly).

This speeds up GVN time on gcc.c-torture/20001226-1.c from 36.4s to 16.3s,
which still isn't great, but substantially better and this is a simple speedup
that applies to lots of different cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91851 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5362c545e8404327582f4515499fcb39186aff1c 22-Dec-2009 Chris Lattner <sabre@nondot.org> refactor some code out to a new helper method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91849 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
ad12b2698baaa0b4168a933e9c9a2756e208521a 18-Dec-2009 Dan Gohman <gohman@apple.com> Eliminte unnecessary uses of <cstdio>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4bbf4ee1491637c247e195e19e3e4a8ee5ad72fa 15-Dec-2009 Chris Lattner <sabre@nondot.org> Remove isPod() from DenseMapInfo, splitting it out to its own
isPodLike type trait. This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91421 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
16f244e9822ffca7818d202df90cd2049f5b6cf6 10-Dec-2009 Chris Lattner <sabre@nondot.org> Fix PR5744, a case where we were getting the pointer size instead of the
value size. This only manifested when memdep inprecisely returns clobber,
which is do to a caching issue in the PR5744 testcase. We can 'efficiently
emulate' this by using '-no-aa'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b6760b4a1eb661b517a3fe74c4d54714ef208010 10-Dec-2009 Chris Lattner <sabre@nondot.org> allow this to build when the #if 0's are enabled. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90999 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
af064aeee607b8a69ce5b9d50482431b753b16e1 09-Dec-2009 Chris Lattner <sabre@nondot.org> fix hte last remaining known (by me) phi translation bug. When we reanalyze
clobbers to forward pieces of large stores to small loads, we need to consider
the properly phi translated pointer in the store block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90978 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b2c6ae8c0b4f27b97ee3c546554c257331512066 09-Dec-2009 Chris Lattner <sabre@nondot.org> change GetStoreValueForLoad to use IRBuilder, which is cleaner and
implicitly constant folds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4ca70fe15f7bafc761a90483a61aad72c3f157b7 09-Dec-2009 Chris Lattner <sabre@nondot.org> change AnalyzeLoadFromClobberingMemInst/AnalyzeLoadFromClobberingStore
to require the load ty/ptr to be passed in, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90960 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
03f17da4dade799132a3224f194779d342a96722 09-Dec-2009 Chris Lattner <sabre@nondot.org> change AnalyzeLoadFromClobberingWrite and clients to pass in type
and pointer instead of the load. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90959 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e18b97121c286eeff5efe89150b093bf1b7b7bfc 09-Dec-2009 Chris Lattner <sabre@nondot.org> change NonLocalDepEntry from being a typedef for an std::pair to be its
own small class. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90956 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b3f927f6ddde88e12ec74dd7622d28df587e768b 09-Dec-2009 Chris Lattner <sabre@nondot.org> add some aborts to #if 0's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90929 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
05e15f8897bd949f9d4bce073d53ed3256c71e2b 09-Dec-2009 Chris Lattner <sabre@nondot.org> Switch GVN and memdep to use PHITransAddr, which correctly handles
phi translation of complex expressions like &A[i+1]. This has the
following benefits:

1. The phi translation logic is all contained in its own class with
a strong interface and verification that it is self consistent.

2. The logic is more correct than before. Previously, if intermediate
expressions got PHI translated, we'd miss the update and scan for
the wrong pointers in predecessor blocks. @phi_trans2 is a testcase
for this.

3. We have a lot less code in memdep.

We can handle phi translation across blocks of things like @phi_trans3,
which is pretty insane :).

This patch should fix the miscompiles of 255.vortex, and I tested it
with a bootstrap of llvm-gcc, llvm-test and dejagnu of course.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90926 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
bc9a28dd544e37074693333ea96c508a3d3bc3b4 06-Dec-2009 Chris Lattner <sabre@nondot.org> constant fold loads from memcpy's from global constants. This is important
because clang lowers nontrivial automatic struct/array inits to memcpy from
a global array.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
cb9cbc494975dc827465af32d806e7b9ae17090c 06-Dec-2009 Chris Lattner <sabre@nondot.org> add support for forwarding mem intrinsic values to non-local loads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
faf815b9380baef522becff67da7b9c3b0f1638d 06-Dec-2009 Chris Lattner <sabre@nondot.org> Handle forwarding local memsets to loads. For example, we optimize this:

short x(short *A) {
memset(A, 1, sizeof(*A)*100);
return A[42];
}

to 'return 257' instead of doing the load.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90695 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c9f2027adb6f700b0a2822cd9bee1d2623b0c9e5 03-Dec-2009 Owen Anderson <resistor@mac.com> Fix this crasher, and add a FIXME for a missed optimization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90408 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9ff5a23186f8761d9e5b4b5adf6fae9ce7d63860 02-Dec-2009 Owen Anderson <resistor@mac.com> Cleanup/remove some parts of the lifetime region handling code in memdep and GVN,
per Chris' comments. Adjust testcases to match.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90304 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
720e790480fed373752b84c178c1a9798d4415b8 02-Dec-2009 Chris Lattner <sabre@nondot.org> factor some code better.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0c264b16b0e8a373888d1a5cfeb90af4fda3cd14 28-Nov-2009 Chris Lattner <sabre@nondot.org> reenable load address insertion in load pre. This allows us to
handle cases like this:
void test(int N, double* G) {
long j;
for (j = 1; j < N - 1; j++)
G[j+1] = G[j] + G[j+1];
}

where G[1] isn't live into the loop.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90041 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
dd696052f0e4ecc973d105be19cf1b4b72f9a0c4 28-Nov-2009 Chris Lattner <sabre@nondot.org> Enhance InsertPHITranslatedPointer to be able to return a list of newly
inserted instructions. No functionality change until someone starts using it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90039 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
971fd57f7d8f6496c5170499ac40ddee538488b3 27-Nov-2009 Chris Lattner <sabre@nondot.org> disable value insertion for now, I need to figure out how
to inform GVN about the newly inserted values. This fixes
PR5631.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90022 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
6f7b210b2577fbc9247a9fc5223655390008ae89 27-Nov-2009 Chris Lattner <sabre@nondot.org> Rework InsertPHITranslatedPointer to handle the recursive case, this
fixes PR5630 and sets the stage for the next phase of goodness (testcase
pending).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90019 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
616613d7a4ddc7cefce53b2bfe3fdcdec6b032c2 27-Nov-2009 Chris Lattner <sabre@nondot.org> teach GVN's load PRE to insert computations of the address in predecessors
where it is not available. It's unclear how to get this inserted
computation into GVN's scalar availability sets, Owen, help? :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89997 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
62deff066c5ee4474be80ed2d95aca010e237343 27-Nov-2009 Chris Lattner <sabre@nondot.org> Fix phi translation in load PRE to agree with the phi
translation done by memdep, and reenable gep translation
again.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4ec01b268e85b62b0eabe27d8fd97e8066a81b8f 14-Nov-2009 Dan Gohman <gohman@apple.com> Add an option for running GVN with redundant load processing disabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88742 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
81cf4325698b48b02eddab921ac333c7f25005c3 10-Nov-2009 Jeffrey Yasskin <jyasskin@google.com> Fix DenseMap iterator constness.

This patch forbids implicit conversion of DenseMap::const_iterator to
DenseMap::iterator which was possible because DenseMapIterator inherited
(publicly) from DenseMapConstIterator. Conversion the other way around is now
allowed as one may expect.

The template DenseMapConstIterator is removed and the template parameter
IsConst which specifies whether the iterator is constant is added to
DenseMapIterator.

Actually IsConst parameter is not necessary since the constness can be
determined from KeyT but this is not relevant to the fix and can be addressed
later.

Patch by Victor Zverovich!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86636 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
fb6e701f08d7ec065222abbbc6727dc80de3d17e 31-Oct-2009 Chris Lattner <sabre@nondot.org> Make sure PRE doesn't split crit edges from indirectbr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85692 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2f192c256c28f3b6c018f59e96380cd26f59c767 30-Oct-2009 Evan Cheng <evan.cheng@apple.com> Add option to createGVNPass to disable PRE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85609 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b62f792e78df12a43029352eb4c7cde9d456c67e 28-Oct-2009 Owen Anderson <resistor@mac.com> Treat lifetime begin/end markers as allocations/frees respectively for the
purposes for GVN/DSE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85383 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
f006b183e2d2bebcf6968d1dd7350397c95b0325 27-Oct-2009 Victor Hernandez <vhernandez@apple.com> Rename MallocFreeHelper as MemoryBuiltins

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85286 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
f2becca90b832cc02345fba063b9b439b2be33ad 27-Oct-2009 Victor Hernandez <vhernandez@apple.com> Rename MallocHelper as MallocFreeHelper, since it now also identifies calls to free()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85181 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7b929dad59785f62a66f7c58615082f98441e95e 23-Oct-2009 Victor Hernandez <vhernandez@apple.com> Remove AllocationInst. Since MallocInst went away, AllocaInst is the only subclass of AllocationInst, so it no longer is necessary.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84969 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a52fce49eb3ee08a4829faf68e32476ff717893b 21-Oct-2009 Chris Lattner <sabre@nondot.org> make GVN work better when TD is not around:

"In the existing code, if the load and the value to replace it with are
of different types *and* target data is available, it tries to use the
target data to coerce the replacement value to the type of the load.
Otherwise, it skips all effort to handle the type mismatch and just
feeds the wrongly-typed replacement value to replaceAllUsesWith, which
triggers an assertion.

The patch replaces it with an outer if checking for type mismatch, and
an inner if-else that checks whether target data is available and, if
not, returns false rather than trying to replace the load."

Patch by Kenneth Uildriks!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84739 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
d41ed4e2c41776b9983583b2851959d0a20be1b2 20-Oct-2009 Owen Anderson <resistor@mac.com> Refactor lookup_or_add to contain _MUCH_ less duplicated code. Add support for
numbering first class aggregate instructions while we're at it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84547 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
158d86e5b0d0a11bfce694b16bafb60c7f9507ff 19-Oct-2009 Owen Anderson <resistor@mac.com> Simplify some code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84533 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9674d15120d657c9a9e681a7dc668349fa3a8de0 14-Oct-2009 Devang Patel <dpatel@apple.com> Use isVoidTy()


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84118 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a09fbf0af04ae7684d7b733e187b88e8b6ff1461 11-Oct-2009 Chris Lattner <sabre@nondot.org> switch GVN to use SSAUpdater. Besides removing a lot of complexity
from GVN, this also speeds it up, inserts fewer PHI nodes (see the
testcase) and allows it to remove more loads (due to fewer PHI nodes
standing in the way).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83746 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
813dbd59127973b1cba17933ca368d3d734121d6 11-Oct-2009 Chris Lattner <sabre@nondot.org> remove dead code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83742 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2d7f1d24bf32418de4ff817284eb5222726c2c62 10-Oct-2009 Chris Lattner <sabre@nondot.org> random tidying


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83701 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9b1de9559316274e8d0d7573d1621cef8ad7c8d6 27-Sep-2009 Chris Lattner <sabre@nondot.org> simplify some code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82936 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
6776064d190701c5bae4d5403939eed2e480d1cd 27-Sep-2009 Nick Lewycky <nicholas@mxc.ca> Instruction::clone does not need to take an LLVMContext&. Remove that and
update all the callers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82889 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
19ad784dacc10247d47d0928f6222390c60fbb4b 21-Sep-2009 Chris Lattner <sabre@nondot.org> big endian systems shift by bits too, hopefully this will fix the ppc
bootstrap problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82464 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8b2bc3d5746c6094e90c416d72c3646227598ae3 21-Sep-2009 Chris Lattner <sabre@nondot.org> fix PR5016, a crash I introduced in GVN handing first class
arrays and structs, which cannot be bitcast to integers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82460 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4fbd14e80e11ec3ec9f240919e4a4a0186620c0c 21-Sep-2009 Chris Lattner <sabre@nondot.org> enable non-local analysis and PRE of large store -> little load.
This doesn't kick in too much because of phi translation issues,
but this can be resolved in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82447 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
879135145f8c1efc09dceee54e6fa87cae63565c 21-Sep-2009 Chris Lattner <sabre@nondot.org> convert an std::pair to an explicit struct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82446 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
ca74940fee04662a61cee290a1b04ef2f2b52c09 21-Sep-2009 Chris Lattner <sabre@nondot.org> move some functions, add a comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82444 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1ce0829e83290bdafc6dbe0427708b509d3c8c0e 21-Sep-2009 Chris Lattner <sabre@nondot.org> split HandleLoadFromClobberingStore in two pieces: one that does the
analysis, one that does the xform.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82443 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
eed919b1ba4c6186258b4beb951625703c1c568e 21-Sep-2009 Chris Lattner <sabre@nondot.org> Improve GVN to be able to forward substitute a small load
from a piece of a large store when both are in the same block.

This allows clang to compile the testcase in PR4216 to this code:

_test_bitfield:
movl 4(%esp), %eax
movl %eax, %ecx
andl $-65536, %ecx
orl $32962, %eax
andl $40186, %eax
orl %ecx, %eax
ret

This is not ideal, but is a whole lot better than the code produced
by llvm-gcc:

_test_bitfield:
movw $-32574, %ax
orw 4(%esp), %ax
andw $-25350, %ax
movw %ax, 4(%esp)
movw 7(%esp), %cx
shlw $8, %cx
movzbl 6(%esp), %edx
orw %cx, %dx
movzwl %dx, %ecx
shll $16, %ecx
movzwl %ax, %eax
orl %ecx, %eax
ret

and dramatically better than that produced by gcc 4.2:

_test_bitfield:
pushl %ebx
call L3
"L00000000001$pb":
L3:
popl %ebx
movl 8(%esp), %eax
leal 0(,%eax,4), %edx
sarb $7, %dl
movl %eax, %ecx
andl $7168, %ecx
andl $-7201, %ebx
movzbl %dl, %edx
andl $1, %edx
sall $5, %edx
orl %ecx, %ebx
orl %edx, %ebx
andl $24, %eax
andl $-58336, %ebx
orl %eax, %ebx
orl $32962, %ebx
movl %ebx, %eax
popl %ebx
ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82439 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b2412a8bec5a6e9827dabe916df811c07753d174 21-Sep-2009 Chris Lattner <sabre@nondot.org> formatting cleanups, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82426 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
771a5422e167200f8a750449f688215f9abe925a 20-Sep-2009 Chris Lattner <sabre@nondot.org> Move CoerceAvailableValueToLoadType earlier in GVN.cpp. Hook it up
so that nonlocal and partially redundant loads can use it as well.
The testcase shows examples of craziness this can handle. This triggers
*many* times in 176.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
6af4b7ce4d4d462fec2e9b9cf3661cc918fcc57c 20-Sep-2009 Chris Lattner <sabre@nondot.org> change the interface to CoerceAvailableValueToLoadType to be
more generic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82402 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
bb6495cc673db919225768a62872b79205a3af41 20-Sep-2009 Chris Lattner <sabre@nondot.org> enhance GVN to forward substitute a stored value to a load
(and load -> load) when the base pointers must alias but when
they are different types. This occurs very very frequently in
176.gcc and other code that uses bitfields a lot.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82399 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a279bc3da55691784064cb47200a1c584408b8ab 20-Sep-2009 Daniel Dunbar <daniel@zuster.org> Tabs -> spaces, and remove trailing whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82355 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
83d63919bd990ce00f62e18114504b9e4a5cb35e 19-Sep-2009 Victor Hernandez <vhernandez@apple.com> Enhance transform passes so that they apply the same tranforms to malloc calls as to MallocInst.

Reviewed by Dan Gohman.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82300 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
bccfc24c4e8092e1ee18746dd4cee01247728faa 03-Sep-2009 Dan Gohman <gohman@apple.com> Change PHINode::hasConstantValue to have a DominatorTree argument
instead of a bool argument, and to do the dominator check itself.
This makes it eaiser to use when DominatorTree information is
available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80920 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3e8b6631e67e01e4960a7ba4668a50c596607473 02-Sep-2009 Chris Lattner <sabre@nondot.org> eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80766 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4eebf0bbfaecb8cee89f38d34c28ae673eab09dd 27-Aug-2009 Owen Anderson <resistor@mac.com> Make this into a static method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80170 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1d0be15f89cb5056e20e2d24faa8d6afb1573bca 13-Aug-2009 Owen Anderson <resistor@mac.com> Push LLVMContexts through the IntegerType APIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78948 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2a29899d74476e2a14069af7231ab76d8322a157 31-Jul-2009 Dan Gohman <gohman@apple.com> Fix GVN's debug output, now that operator<< on Value* doesn't print
a trailing newline.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77719 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5defacc6e605f4651c6300237cef8e9bb2eb6d0e 31-Jul-2009 Owen Anderson <resistor@mac.com> Move getTrue() and getFalse() to 2.5-like APIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77685 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9e9a0d5fc26878e51a58a8b57900fcbf952c2691 31-Jul-2009 Owen Anderson <resistor@mac.com> Move more code back to 2.5 APIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77635 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
fd87a544c00c2ca04ee23aae67bbcad4dc852a54 25-Jul-2009 Dan Gohman <gohman@apple.com> Convert a few more things to use raw_ostream.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77039 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
ce63ffb52f249b62cdf2d250c128007b13f27e71 25-Jul-2009 Daniel Dunbar <daniel@zuster.org> More migration to raw_ostream, the water has dried up around the iostream hole.
- Some clients which used DOUT have moved to DEBUG. We are deprecating the
"magic" DOUT behavior which avoided calling printing functions when the
statement was disabled. In addition to being unnecessary magic, it had the
downside of leaving code in -Asserts builds, and of hiding potentially
unnecessary computations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77019 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e922c0201916e0b980ab3cfe91e1413e68d55647 22-Jul-2009 Owen Anderson <resistor@mac.com> Get rid of the Pass+Context magic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76702 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b3056faa5554ded7ac1ac5865d10ef5839fb77d3 21-Jul-2009 Owen Anderson <resistor@mac.com> Rename getConstantInt{True|False} to get{True|False} at Chris' behest.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76598 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c23197a26f34f559ea9797de51e187087c039c42 14-Jul-2009 Torok Edwin <edwintorok@gmail.com> llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c25e7581b9b8088910da31702d4ca21c4734c6d7 11-Jul-2009 Torok Edwin <edwintorok@gmail.com> assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
333c40096561218bc3597cf153c0a3895274414c 10-Jul-2009 Owen Anderson <resistor@mac.com> This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75200 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7f6aa2b162e5daaf7b9ccf05d749597d3d7cf460 08-Jul-2009 Nick Lewycky <nicholas@mxc.ca> Remove the vicmp and vfcmp instructions. Because we never had a release with
these instructions, no autoupgrade or backwards compatibility support is
provided.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74991 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
d672ecb0178c6247a5eaa5b0fb0c3b23cd25bd7c 03-Jul-2009 Owen Anderson <resistor@mac.com> Convert the first batch of passes to use LLVMContext.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74748 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
42c3f554f4d5e505c3e43cdcf722ec82a7a3f6a5 17-Jun-2009 Dale Johannesen <dalej@apple.com> This fixes a bug introduced in 72661, which can
move loads back past a check that the load address
is valid, see new testcase. The test that went
in with 72661 has exactly this case, except that
the conditional it's moving past is checking
something else; I've settled for changing that
test to reference a global, not a pointer. It
may be possible to scan all the tests you pass and
make sure none of them are checking any component
of the address, but it's not trivial and I'm not
trying to do that here.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4306b1a329cbaf1e866bead2cd6042859a808c8a 17-Jun-2009 Torok Edwin <edwintorok@gmail.com> Add debug message about non-local loads being clobbered.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73625 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c915c959780ab7de7c61d7cf8c692762d29d1897 15-Jun-2009 Dan Gohman <gohman@apple.com> Make the EnableLoadPRE variable static.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73398 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
ae3a0be92e33bc716722aa600983fc1535acb122 05-Jun-2009 Dan Gohman <gohman@apple.com> Split the Add, Sub, and Mul instruction opcodes into separate
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.

For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.

This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72897 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
88554df4a2b801a11964a2668acfac2d68ab14bc 31-May-2009 Owen Anderson <resistor@mac.com> Be more aggressive in doing LoadPRE by tracing backwards when a block only has
a single predecessor.

Patch by Jakub Staszak.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72661 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3c04296b837e96f1579b4fc8e94cc1d1848ea2aa 29-May-2009 Bill Wendling <isanbard@gmail.com> Enable GVN Load PRE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
70ac142560a7fcf801c5635175a4760a0dd669cd 29-May-2009 Torok Edwin <edwintorok@gmail.com> just show the instruction, its not that slow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72577 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7e55a00d061629e5e38a1072d03618a5b76a8f9a 29-May-2009 Torok Edwin <edwintorok@gmail.com> for instructions with void type we have no choice but print the instruction as
is, otherwise we get a <badref>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72567 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3f3c6d4e5be4b916ed9d30ba85a428e01a65d8c5 29-May-2009 Torok Edwin <edwintorok@gmail.com> Add a DEBUG() output to GVN that prints the instruction clobbering a load.
This is useful when trying to figure out why GVN didn't eliminate redundant
loads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72565 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
246ddf55d12c3347a5a4e5d1cc04e6a31974f0c8 29-May-2009 Owen Anderson <resistor@mac.com> Fix an issue where phiMap was not being updated properly when doing load PRE.

Diagnosis and patch thanks to Jakub Staszak.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72562 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7af1c78b98d2df7d0ab9154461ca3d835706716e 06-May-2009 Duncan Sands <baldrick@free.fr> Allow readonly functions to unwind exceptions. Teach
the optimizers about this. For example, a readonly
function with no uses cannot be removed unless it is
also marked nounwind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71071 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e8a290fefcbf443d7c85149f5c14a5a305aeaf29 02-Apr-2009 Owen Anderson <resistor@mac.com> Reapply r68211, with the miscompilations it caused fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68262 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e63c4a2010a5e09f8607b914bce0bac8cf38cd20 01-Apr-2009 Dan Gohman <gohman@apple.com> Revert r68172. It caused regressions in
Applications/Burg/burg
Applications/ClamAV/clamscan
and many other tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68211 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
f41fcbb60d909ebae0e31300322b94922c1ee886 01-Apr-2009 Owen Anderson <resistor@mac.com> Enhance GVN to propagate simple conditionals. This fixes PR3921.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68172 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
090c0a2ffd0e3374ca55e964773c44ae2a3c80e7 10-Mar-2009 John Criswell <criswell@uiuc.edu> Do not attempt to do parial redundancy elimination on void values.
Also fixed a punctuation error in the header comment.
This fixes PR3775.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c64bc16cae098d87aafca438adb21bc580be1db1 06-Mar-2009 Devang Patel <dpatel@apple.com> Skip DbgInfoIntrinsic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66244 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0aefc0eb2ce18937351348f2aa3d74f27923b8f8 12-Feb-2009 Chris Lattner <sabre@nondot.org> improve naming of values in GVN, patch by Jay Foad!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64363 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b805030e02452b9724aafca5ad7a30c66e6e357c 08-Feb-2009 Bill Wendling <isanbard@gmail.com> Mistakenly turned this on.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64065 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7f51fd3ea93232658388757fcc8121f14f4454bc 08-Feb-2009 Bill Wendling <isanbard@gmail.com> Revert r63999. It was breaking self-hosting builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64062 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2f39b29170e0f69491fc5b73952725266ac32fb8 19-Jan-2009 Chris Lattner <sabre@nondot.org> improve compatibility with cygwin, patch by Jay Foad!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62535 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
ae53c932b9f3b6046781aeceadc7559bc477f5d4 23-Dec-2008 Owen Anderson <resistor@mac.com> Don't forget to remove phi nodes from the value numbering table after we collapse them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61358 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
30788b828a6101c6b20bedc59609dd5ce907a845 22-Dec-2008 Bill Wendling <isanbard@gmail.com> Comment clean-ups. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61354 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
6d463f2efc79f910df60b9851dccf3e36651ae41 22-Dec-2008 Bill Wendling <isanbard@gmail.com> Check that the instruction isn't in the value numbering scope.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61353 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
75f02ee771bae2d6682f873895cd003bac60ba7e 22-Dec-2008 Bill Wendling <isanbard@gmail.com> Simplification: Negate the operator== method instead of implementing a full operator!= method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61352 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
70ded19b3f69b8795423ec301da4ad9143ba9f15 22-Dec-2008 Bill Wendling <isanbard@gmail.com> Add verification that deleted instruction isn't hiding in the PHI map.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61350 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
ec40d50aa41795adcf62ba30e3ddebb7c5c9f339 22-Dec-2008 Bill Wendling <isanbard@gmail.com> Verify removed in a few more places.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61349 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
246dbbb8befcb04abb5451d73b5d94f7d21f22c6 22-Dec-2008 Bill Wendling <isanbard@gmail.com> Add verification functions to GVN which check to see that an instruction was
truely deleted. These will be expanded with further checks of all of the data
structures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61347 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e533f4e343d2010123b895251aab8ff40c133460 18-Dec-2008 Bill Wendling <isanbard@gmail.com> Didn't mean to commit this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61222 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
82c19ae10a1486176b031dad41a4c22087fbde99 18-Dec-2008 Bill Wendling <isanbard@gmail.com> Re-XFAIL this test until debug stuff settles down.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5f4f84ba3ec3cd5c9d6fb8acd770042a5cfdf8aa 18-Dec-2008 Chris Lattner <sabre@nondot.org> reapply this hunk from Bill's reversion in r61169, it is conservative
and safe and orthogonal from turning off load pre.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61177 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
13d10096e1e2c1185c89d94ca69827a737550afd 18-Dec-2008 Bill Wendling <isanbard@gmail.com> Temporarily revert r61027. It was causing a bootstrap failure in "release" mode
with everyone's favorite error messages:

Comparing stages 2 and 3
warning: ./cc1-checksum.o differs
warning: ./cc1plus-checksum.o differs
Bootstrap comparison failure!
./c-decl.o differs
./cp/decl.o differs
./df-core.o differs
./gcc.o differs
./i386.o differs
./stor-layout.o differs
./tree-pretty-print.o differs
./tree.o differs
make[2]: *** [compare] Error 1
make[1]: *** [stage3-bubble] Error 2

See PR3227.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61169 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2ba3b621495b89f45521e627554a40a9885899e7 15-Dec-2008 Chris Lattner <sabre@nondot.org> Enable Load PRE. This teaches GVN to push partially redundant loads up the
CFG when there is exactly one predecessor where the load is not available.
This is designed to not increase code size but still eliminate partially
redundant loads. This fires 1765 times on 403.gcc even though it doesn't
do critical edge splitting yet (the most common reason for it to fail).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61027 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c34d1123622ca99efffc8ae4fdb194ae4f1a66bc 15-Dec-2008 Owen Anderson <resistor@mac.com> Ifdef out some code that I didn't mean to enable by default yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
f33131685bb9de34dd876641bdf2d514fb49ce4c 15-Dec-2008 Chris Lattner <sabre@nondot.org> make GVN try to rename inputs to the resultant replaced values, which
cleans up the generated code a bit. This should have the added benefit of
not randomly renaming functions/globals like my previous patch did. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61023 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
255dafc5de1e0e15ccebc9f5947330833008374a 15-Dec-2008 Owen Anderson <resistor@mac.com> Add support for slow-path GVN with full phi construction for scalars. This is disabled for now, as it actually pessimizes code in the abscence
of phi translation for load elimination. This slow down GVN a bit, by about 2% on 403.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61021 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
cbe1d940313a0e7d75820f2c92a6c089fbc15f5a 14-Dec-2008 Owen Anderson <resistor@mac.com> Generalize GVN's phi construciton routine to work for things other than loads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8295e49e768d0ece4204d41416d500f572a3faf8 13-Dec-2008 Bill Wendling <isanbard@gmail.com> Temporarily revert r60973. It's inexplicably causing a failure when self-hosting LLVM:

llvm[2]: Linking Release executable opt (without symbols)
...
Undefined symbols:
"llvm::APFloat::IEEEsingle", referenced from:
__ZN4llvm7APFloat10IEEEsingleE$non_lazy_ptr in libLLVMCore.a(Constants.o)
__ZN4llvm7APFloat10IEEEsingleE$non_lazy_ptr in libLLVMCore.a(AsmWriter.o)
__ZN4llvm7APFloat10IEEEsingleE$non_lazy_ptr in libLLVMCore.a(ConstantFold.o)
"llvm::APFloat::IEEEdouble", referenced from:
__ZN4llvm7APFloat10IEEEdoubleE$non_lazy_ptr in libLLVMCore.a(Constants.o)
__ZN4llvm7APFloat10IEEEdoubleE$non_lazy_ptr in libLLVMCore.a(AsmWriter.o)
__ZN4llvm7APFloat10IEEEdoubleE$non_lazy_ptr in libLLVMCore.a(ConstantFold.o)
ld: symbol(s) not found

This is in release mode. To replicate, compile llvm and llvm-gcc in optimized
mode. Then build llvm, in optimized mode, with the newly created compiler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
879922932fad4149280b8bc03c60f0003f55a778 13-Dec-2008 Chris Lattner <sabre@nondot.org> make RLE preserve the name of the load that it replaces. This is just
a pretification of the IR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60973 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
bc99be10b815e0bfc5102bd5746e9a80feebf6f4 09-Dec-2008 Chris Lattner <sabre@nondot.org> Teach GVN to invalidate some memdep information when it does an RAUW
of a pointer. This allows is to catch more equivalencies. For example,
the type_lists_compatible_p function used to require two iterations of
the gvn pass (!) to delete its 18 redundant loads because the first pass
would CSE all the addressing computation cruft, which would unblock the
second memdep/gvn passes from recognizing them. This change allows
memdep/gvn to catch all 18 when run just once on the function (as is
typical :) instead of just 3.

On all of 403.gcc, this bumps up the # reundandancies found from:

63 gvn - Number of instructions PRE'd
153991 gvn - Number of instructions deleted
50069 gvn - Number of loads deleted
to:
63 gvn - Number of instructions PRE'd
154137 gvn - Number of instructions deleted
50185 gvn - Number of loads deleted

+120 loads deleted isn't bad.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60799 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1559b3625be7b80bee6b066af4b91b9d10dfb5fa 09-Dec-2008 Chris Lattner <sabre@nondot.org> rename getNonLocalDependency -> getNonLocalCallDependency, and remove
pointer stuff from it, simplifying the code a bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60783 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
91bcf6450ab063204a7ccd933d7db40028485147 09-Dec-2008 Chris Lattner <sabre@nondot.org> Switch GVN::processNonLocalLoad to using the new
MemDep::getNonLocalPointerDependency method. There are
some open issues with this (missed optimizations) and
plenty of future work, but this does allow GVN to eliminate
*slightly* more loads (49246 vs 49033).

Switching over now allows simplification of the other code
path in memdep.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60780 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
ae1993114f71c286e0d737776ad48d9eefd3c67a 09-Dec-2008 Chris Lattner <sabre@nondot.org> random cleanups, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b51deb929ca95ce62e622b0475a05d83f26ab04d 05-Dec-2008 Chris Lattner <sabre@nondot.org> Make a few major changes to memdep and its clients:
1. Merge the 'None' result into 'Normal', making loads
and stores return their dependencies on allocations as Normal.
2. Split the 'Normal' result into 'Clobber' and 'Def' to
distinguish between the cases when memdep knows the value is
produced from when we just know if may be changed.
3. Move some of the logic for determining whether readonly calls
are CSEs into memdep instead of it being in GVN. This still
leaves verification that the arguments are hte same to GVN to
let it know about value equivalences in different contexts.
4. Change memdep's call/call dependency analysis to use
getModRefInfo(CallSite,CallSite) instead of doing something
very weak. This only really matters for things like DSA, but
someday maybe we'll have some other decent context sensitive
analyses :)
5. This reimplements the guts of memdep to handle the new results.
6. This simplifies GVN significantly:
a) readonly call CSE is slightly simpler
b) I eliminated the "getDependencyFrom" chaining for load
elimination and load CSE doesn't have to worry about
volatile (they are always clobbers) anymore.
c) GVN no longer does any 'lastLoad' caching, leaving it to
memdep.
7. The logic in DSE is simplified a bit and sped up. A potentially
unsafe case was eliminated.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60607 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
64b535608e03531e0a0a5745724b7e8d819bdd71 05-Dec-2008 Anton Korobeynikov <asl@math.spbu.ru> Revert invalid r60393. It causes llvm-gcc bootstrap fails in release builds.
See PR3160 for details

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60604 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7f7c7366829f58d067fd6a02c0540a01908c5bc2 05-Dec-2008 Chris Lattner <sabre@nondot.org> Fix test/Transforms/GVN/pre-load.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60594 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
72bc70d499f64216defd971ef140cbaa2fad0fbd 05-Dec-2008 Chris Lattner <sabre@nondot.org> Make IsValueFullyAvailableInBlock safe.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60588 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c89c6a964c6091e07a51a22ad8c1c38295eb8599 02-Dec-2008 Chris Lattner <sabre@nondot.org> Implement PRE of loads in the GVN pass with a pretty cheap and
straight-forward implementation. This does not require any extra
alias analysis queries beyond what we already do for non-local loads.

Some programs really really like load PRE. For example, SPASS triggers
this ~1000 times, ~300 times in 255.vortex, and ~1500 times on 403.gcc.

The biggest limitation to the implementation is that it does not split
critical edges. This is a huge killer on many programs and should be
addressed after the initial patch is enabled by default.

The implementation of this should incidentally speed up rejection of
non-local loads because it avoids creating the repl densemap in cases
when it won't be used for fully redundant loads.

This is currently disabled by default.
Before I turn this on, I need to fix a couple of miscompilations in
the testsuite, look at compile time performance numbers, and look at
perf impact. This is pretty close to ready though.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60408 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
912c49d169479ea713dfdee6fd7a2909c1147dab 02-Dec-2008 Owen Anderson <resistor@mac.com> Fix an issue that Chris noticed, where local PRE was not properly instantiating
a new value numbering set after splitting a critical edge. This increases
the number of instances of PRE on 403.gcc from ~60 to ~570.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60393 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
d0f5bfc9be43997d3d2f09f6616ddbef0df7ddce 01-Dec-2008 Chris Lattner <sabre@nondot.org> Rename some variables, only increment BI once at the start of the loop instead of throughout it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60339 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
09713794c17061ae36cc696cfc928c5a0c2bdc75 01-Dec-2008 Chris Lattner <sabre@nondot.org> pull the predMap densemap out of the inner loop of performPRE, so
that it isn't reallocated all the time. This is a tiny speedup for
GVN: 3.90->3.88s


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
978796eaad4f6cefc2069dc5183679ac7dd8f666 01-Dec-2008 Chris Lattner <sabre@nondot.org> Make GVN be more intelligent about redundant load
elimination: when finding dependent load/stores, realize that
they are the same if aliasing claims must alias instead of relying
on the pointers to be exactly equal. This makes load elimination
more aggressive. For example, on 403.gcc, we had:

< 68 gvn - Number of instructions PRE'd
< 152718 gvn - Number of instructions deleted
< 49699 gvn - Number of loads deleted
< 6153 memdep - Number of dirty cached non-local responses
< 169336 memdep - Number of fully cached non-local responses
< 162428 memdep - Number of uncached non-local responses

now we have:

> 64 gvn - Number of instructions PRE'd
> 153623 gvn - Number of instructions deleted
> 49856 gvn - Number of loads deleted
> 5022 memdep - Number of dirty cached non-local responses
> 159030 memdep - Number of fully cached non-local responses
> 162443 memdep - Number of uncached non-local responses

That's an extra 157 loads deleted and extra 905 other instructions nuked.

This slows down GVN very slightly, from 3.91 to 3.96s.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60314 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
bf145d6e2ba01f5099ccaa1b58ed3619406928a0 01-Dec-2008 Chris Lattner <sabre@nondot.org> Reimplement the non-local dependency data structure in terms of a sorted
vector instead of a densemap. This shrinks the memory usage of this thing
substantially (the high water mark) as well as making operations like
scanning it faster. This speeds up memdep slightly, gvn goes from
3.9376 to 3.9118s on 403.gcc

This also splits out the statistics for the cached non-local case to
differentiate between the dirty and clean cached case. Here's the stats
for 403.gcc:

6153 memdep - Number of dirty cached non-local responses
169336 memdep - Number of fully cached non-local responses
162428 memdep - Number of uncached non-local responses

yay for caching :)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60313 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
663e441a752cabef645fdb2640b6f1d5dc66207b 01-Dec-2008 Chris Lattner <sabre@nondot.org> Cache analyses in ivars and add some useful DEBUG output.
This speeds up GVN from 4.0386s to 3.9376s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1440ac54176cff6cf5ac917ea29ef9adb90b5f6d 01-Dec-2008 Chris Lattner <sabre@nondot.org> improve indentation, do cheap checks before expensive ones,
remove some fixme's. This speeds up GVN very slightly on 403.gcc
(4.06->4.03s)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60309 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
237a8287454389a5b940e18c1efb2201fc443208 30-Nov-2008 Chris Lattner <sabre@nondot.org> Fix a fixme by making memdep's handling of allocations more logical.
If we see that a load depends on the allocation of its memory with no
intervening stores, we now return a 'None' depedency instead of "Normal".
This tweaks GVN to do its optimization with the new result.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60267 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
396a4a55e535728e2023aa331401c1a2b782cb9a 29-Nov-2008 Chris Lattner <sabre@nondot.org> Change MemDep::getNonLocalDependency to return its results as
a smallvector instead of a DenseMap. This speeds up GVN by 5%
on 403.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60255 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
86b29ef64a36c8779ef7855b3c4b95744eb2f08b 29-Nov-2008 Chris Lattner <sabre@nondot.org> reimplement getNonLocalDependency with a simpler worklist
formulation that is faster and doesn't require nonLazyHelper.
Much less code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5391a1d8046396fb4dd005b1910973789f5427f4 29-Nov-2008 Chris Lattner <sabre@nondot.org> Split getDependency into getDependency and getDependencyFrom, the
former does caching, the later doesn't. This dramatically simplifies
the logic in getDependency and getDependencyFrom.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60234 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4c724006256032e827177afeae04ea62436796e7 29-Nov-2008 Chris Lattner <sabre@nondot.org> Introduce and use a new MemDepResult class to hold the results of a memdep
query. This makes it crystal clear what cases can escape from MemDep that
the clients have to handle. This also gives the clients a nice simplified
interface to it that is easy to poke at.

This patch also makes DepResultTy and MemoryDependenceAnalysis::DepType
private, yay.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60231 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
39f372e23e49cecb8db2eb7120eb331173e50c74 29-Nov-2008 Chris Lattner <sabre@nondot.org> Reimplement the internal abstraction used by MemDep in terms
of a pointer/int pair instead of a manually bitmangled pointer.
This forces clients to think a little more about checking the
appropriate pieces and will be useful for internal
implementation improvements later.

I'm not particularly happy with this. After going through this
I don't think that the clients of memdep should be exposed to
the internal type at all. I'll fix this in a subsequent commit.

This has no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60230 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7cdd9ee088343026dd79b4b35da293a6d49d7044 10-Oct-2008 Nuno Lopes <nunoplopes@sapo.pt> fix memleak by cleaning the global sets on pass exit

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57353 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4520dd2b7b20af07d5a3e4d06d964a532044eb10 08-Oct-2008 Duncan Sands <baldrick@free.fr> Add <cstdio> include where needed by gcc-4.4.
Patch by Samuel Tardieu.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57291 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5d0392c6b370758750b397e254a6c6f028479969 01-Oct-2008 Duncan Sands <baldrick@free.fr> Factorize code: remove variants of "strip off
pointer bitcasts and GEP's", and centralize the
logic in Value::getUnderlyingObject. The
difference with stripPointerCasts is that
stripPointerCasts only strips GEPs if all
indices are zero, while getUnderlyingObject
strips GEPs no matter what the indices are.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56922 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.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/Transforms/Scalar/GVN.cpp
0c7f91cf843247a34ae9147af0708d238d43f9f9 04-Sep-2008 Owen Anderson <resistor@mac.com> Fix a bug that prevented PRE from applying in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55744 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
516eb1c1396bc0a2b35573e58c567d6092ed5fd0 27-Aug-2008 Owen Anderson <resistor@mac.com> Put a heuristic in place to prevent GVN from falling into bad cases with massively complicated CFGs.
This speeds up a particular testcase from 12+ hours to 5 seconds with little perceptible loss of quality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55391 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2dba6a1bdb7d78b4d1e5e69b81989816193e6b70 22-Aug-2008 Chris Lattner <sabre@nondot.org> consolidate DenseMapInfo implementations, and add one for std::pair.
Patch contributed by m-s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55167 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
6c4d8e3ee444408eed715308ade4e0b674715cfb 18-Jul-2008 Duncan Sands <baldrick@free.fr> Supress a gcc-4.3 warning.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53771 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e98c54c47ca09207ef2d2d6065a512a6b0ed1f0d 18-Jul-2008 Owen Anderson <resistor@mac.com> Make PRE actually handle critical edges (by splitting them). Confirmed that bootstrap passes with this change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53762 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c2b856e5b4dbd913c1db0fb0abd2c640489781ce 17-Jul-2008 Owen Anderson <resistor@mac.com> Enable PRE. My last batch of changes fixed the miscompile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53730 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b31b06d04b81c5383e2fba0cd44d4ba3f324a794 17-Jul-2008 Owen Anderson <resistor@mac.com> Factor MergeBlockIntoPredecessor out into BasicBlockUtils.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5d0af038a718ff31b1ecf0894bae951e41960e0d 16-Jul-2008 Owen Anderson <resistor@mac.com> There's no need to iterate block merging and PRE. In fact, iterating the latter
could cause problems for memdep when it breaks critical edges.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53691 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2b4f7bbd498c44517a6716192244bd88b7af7529 15-Jul-2008 Owen Anderson <resistor@mac.com> Revert this, as it seems to still be broken.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53627 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b33f7cc7e6ef84127b35c729b65d43a8edd20366 15-Jul-2008 Owen Anderson <resistor@mac.com> Enable local PRE by default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53616 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
961edc8be60e7a4d02ad4729428a09da660d3901 15-Jul-2008 Owen Anderson <resistor@mac.com> Have GVN do a pre-pass over the CFG that folds away unconditional branches where possible. This allows local PRE to be more aggressive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c45996bf7464d4b5bc038abeff362f47fea401d9 11-Jul-2008 Owen Anderson <resistor@mac.com> Don't call lookupNumber more than we have to.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53470 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0ae33ef202b1318888220f147e248af4b994dffc 03-Jul-2008 Owen Anderson <resistor@mac.com> Use information already present in the ValueTable to fast-fail when we know there won't be a value number match. This speeds up GVN on a case where there are very few redundancies by ~25%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53108 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
cb29a4f66a837c2d322ca08d4bcde7440a6f5cdc 02-Jul-2008 Owen Anderson <resistor@mac.com> Avoid a redundant call.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53040 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
f2aa160b357c98d8c37b69ea9775aa3e097d1319 02-Jul-2008 Owen Anderson <resistor@mac.com> A better fix for PR2503 that doesn't pessimize GVN in the presence of unreachable blocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53032 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2e9f0b1a323848f6d548c1e9eb16ece6a3881dbd 23-Jun-2008 Evan Cheng <evan.cheng@apple.com> Disable PRE. It's breaking bootstrapping.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52643 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b70a571c99932464ed828fa425ea1e2783d08fab 23-Jun-2008 Owen Anderson <resistor@mac.com> Tighten the conditions under which we do PRE, remove some unneeded code, and correct our preserved analyses list, since we
do now change the CFG by splitting critical edges during PRE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52631 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4ce138cc5593fb17161308af3cf25981b4088c17 21-Jun-2008 Evan Cheng <evan.cheng@apple.com> Enable PRE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52574 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
f2204d7bb103b1d23c910efc678d5303003635bb 20-Jun-2008 Owen Anderson <resistor@mac.com> Really disable PRE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52531 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
6fafe847b272975c3f7dd5a86874c10793c3c491 20-Jun-2008 Owen Anderson <resistor@mac.com> Change around the data structures used to store availability sets, resulting in a GVN+PRE that is faster that GVN alone was before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
88d11c03cd0aae616e32dc5c09fc72e9429fd9bd 20-Jun-2008 Evan Cheng <evan.cheng@apple.com> Disable PRE for now. It seems to be breaking llvm-gcc bootstrapping.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52518 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
aa0b63422a2170c82e89215bcb7c5c383df62989 19-Jun-2008 Owen Anderson <resistor@mac.com> Add a hidden -disable-pre flag for testing purposes. This should be removed
once benchmarking is completed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52506 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5c274eebc6b5444db123028f29b7491763c08585 19-Jun-2008 Owen Anderson <resistor@mac.com> PRE requires that critical edges be split.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52505 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9da52dce892ff57f40aab29acf909f9b2fba7906 19-Jun-2008 Owen Anderson <resistor@mac.com> Be sure to remove values from the value numbering table after we delete them.
This fixes a failure on povray.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52499 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3cd8eb314a5f41b93a0f1d627fe905caf5651b3c 19-Jun-2008 Owen Anderson <resistor@mac.com> Revert support for insertvalue and extractvalue instructions for the moment.
GVN expects that all inputs which to an instruction fall somewhere in the value
hierarchy, which isn't true for these.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52496 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
d34ac6e7820c8c0ad7f5d5681bc1ecf8b52a2391 18-Jun-2008 Owen Anderson <resistor@mac.com> Add support for extractvalue and insertvalue instructions in GVN.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52472 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b230372437183b8daffcd70fe784974ddf26d21b 18-Jun-2008 Owen Anderson <resistor@mac.com> Add local PRE to GVN. This only operates in cases where it would not increase code size, namely when the instantiated expression
would only need to be created in one predecessor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52471 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2960ed4b85d49fbdb3270605a1bfdbfbdcb97d62 18-Jun-2008 Owen Anderson <resistor@mac.com> We don't want to find dependencies within the same block in this case. It leads to incorrect results because
we're detecting something at or after the call we're querying on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
af4240ac2d5582f3c1c86c46c8c413823e1fc0db 12-Jun-2008 Owen Anderson <resistor@mac.com> Switch GVN to use ScopedHashTable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52242 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
845f524c25de18917f72e8847d7e138d65e4ef08 05-Jun-2008 Matthijs Kooijman <matthijs@stdin.nl> Update comments and documentation to reflect that GCSE and ValueNumbering are
deprecated by the GVN and GVNPRE passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51983 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
10a05bfff08deb739abe11d05e794440c3ab543f 04-Jun-2008 Owen Anderson <resistor@mac.com> Remove unneeded #include.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51955 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1d6e4091f69bea5010997846cfdf3778a9766eee 18-May-2008 Nate Begeman <natebegeman@mac.com> Teach GVN to not assert on vector comparisons


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51230 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c4f406e736d2cb5f313eef50abe1c0c935c4090e 14-May-2008 Owen Anderson <resistor@mac.com> Fix Analysis/BasicAA/pure-const-dce.ll. This turned out to be a correctness
bug as well as a missed optimization. We weren't properly checking for local
dependencies before moving on to non-local ones when doing non-local read-only
call CSE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51082 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
16db1f70b780db099972b05ec6418a3f82d46d91 13-May-2008 Owen Anderson <resistor@mac.com> Make the non-local CSE safety checks slightly more thorough.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51035 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3b3f58cb774cb36a9b26d37f6ea2387b27d3df9d 13-May-2008 Owen Anderson <resistor@mac.com> Add support for non-local CSE of read-only calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a472c4a2800122429c435a5b5bbdfb12e5496891 12-May-2008 Owen Anderson <resistor@mac.com> Go back to passing the analyses around as parameters.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50995 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7b45e33107b59275cfb11f7e8b2de26db7530f3c 12-May-2008 Owen Anderson <resistor@mac.com> Move the various analyses used by GVN into static variables so we don't have to keep passing them around or refetching them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50963 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4bda6e47e95204e6d9e7bf2b82e8099e911c722a 21-Apr-2008 Owen Anderson <resistor@mac.com> Remove unneeded #include's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50035 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
241f65321efc6ad84ed875cd9494df8ca1cff309 17-Apr-2008 Owen Anderson <resistor@mac.com> Make GVN able to remove unnecessary calls to read-only functions again.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49842 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8f46c78fcc96dd748fe3568ada91c18de7d9e68e 11-Apr-2008 Owen Anderson <resistor@mac.com> Fix PR2213 by simultaneously making GVN more aggressive with the return values
of calls and less aggressive with non-readnone calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49516 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a723d1e48f4a261512c28845c53eda569fa5218c 09-Apr-2008 Owen Anderson <resistor@mac.com> Factor a bunch of functionality related to memcpy and memset transforms out of
GVN and into its own pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49419 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
82a66291b0a0b75016ef3cb638721503565c43d0 09-Apr-2008 Owen Anderson <resistor@mac.com> Remove accidentally duplicated code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49418 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
412821284f16a683e9b734baf2b6c9b4635857f2 07-Apr-2008 Owen Anderson <resistor@mac.com> Add operator= implementations to SparseBitVector, allowing it to be used in GVN. This results
in both time and memory savings for GVN. For example, one testcase went from 10.5s to 6s with
this patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49345 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e5ffa900f8cf486fae4f542d72d84e6bab0129ae 07-Apr-2008 Owen Anderson <resistor@mac.com> Make GVN more memory efficient, particularly on code that contains a large number of
allocations, which GVN can't optimize anyways.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49329 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
051a950000e21935165db56695e35bade668193b 06-Apr-2008 Gabor Greif <ggreif@gmail.com> API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49277 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
97ae12a98845c44807b4ee833d86c0b4d2521d05 29-Mar-2008 Chris Lattner <sabre@nondot.org> change iterator invalidation avoidance to just move the iterator backward
when something changes, instead of moving forward. This allows us to
simplify memset lowering, inserting the memset at the end of the range of
stuff we're touching instead of at the start.

This, in turn, allows us to make use of the addressing instructions already
used in the function instead of inserting our own. For example, we now
codegen:

%tmp41 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 0 ; <i8*> [#uses=2]
call void @llvm.memset.i64( i8* %tmp41, i8 -1, i64 8, i32 1 )

instead of:

%tmp20 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 7 ; <i8*> [#uses=1]
%ptroffset = getelementptr i8* %tmp20, i64 -7 ; <i8*> [#uses=1]
call void @llvm.memset.i64( i8* %ptroffset, i8 -1, i64 8, i32 1 )



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
d22fe2b51f553f7eca200cd22b9e2247f9aea2ff 29-Mar-2008 Chris Lattner <sabre@nondot.org> make the common case of a single store (which clearly shouldn't be turned
into a memset!) faster by avoiding an allocation of an std::list node.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9f8a6a749814836c506d27e4f857882014aea1a0 29-Mar-2008 Chris Lattner <sabre@nondot.org> give form-memset a significantly more sane heuristic, enable it by default.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48937 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7f0965e7daa17f0c5987fb923cab94ed7f6f4d78 28-Mar-2008 Chris Lattner <sabre@nondot.org> make memset inference significantly more powerful: it can now handle
memsets that initialize "structs of arrays" and other store sequences
that are not sequential. This is still only enabled if you pass
-form-memset-from-stores. The flag is not heavily tested and I haven't
analyzed the perf regressions when -form-memset-from-stores is passed
either, but this causes no make check regressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48909 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
88ffdddcc42d80972644643da1096793dabae802 24-Mar-2008 Evan Cheng <evan.cheng@apple.com> Temporarily disabling memset forming optimization. Add an option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48720 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b017c9e89cdd971a992a414e29caad0232b89a0d 22-Mar-2008 Chris Lattner <sabre@nondot.org> implement an initial hack at a straight-line store -> memset optimization.
This fires dozens of times across spec and multisource, but I don't know
if it actually speeds stuff up. Hopefully the testers will show something
nice :)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
d27290d733acc50542e7a619a592e6a2aafd3883 22-Mar-2008 Chris Lattner <sabre@nondot.org> implement the logic for memset insertion and store deletion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
641dae19eb5edf62ce6cd928da8bfeee561d641f 22-Mar-2008 Chris Lattner <sabre@nondot.org> This is a partially implemented and currently disabled start of a store
merging optimization. Nothing to see here, hopefully more later :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48670 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8e1e95cb043c9eb7766d283587cd0a830b1f3209 21-Mar-2008 Chris Lattner <sabre@nondot.org> the size of a smallvector shouldn't be part of the interface to these methods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48662 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2e60701b9d7ab5a0a8c68ed888665865554b6f4d 21-Mar-2008 Chris Lattner <sabre@nondot.org> make gvn marginally faster by reallocating the lastSeenLoad map for
each basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48660 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
88365bb4047a91d42af2aa42839b21e701ea1b03 21-Mar-2008 Chris Lattner <sabre@nondot.org> Minor cleanups and shrinkification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48658 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8a97fddbc2c064e295ad5fb6269795bd904e1ed2 13-Mar-2008 Owen Anderson <resistor@mac.com> Fix a bug in GVN that Duncan noticed, where we potentially need to insert a
pointer bitcast when performing return slot optimization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48343 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
6bb0bd52ecf7481c26cb2d211d6f4f41a6edc855 12-Mar-2008 Owen Anderson <resistor@mac.com> Improve the return slot optimization to be both more aggressive (not limited to sret parameters), and
safer (when the passed pointer might be invalid). Thanks to Duncan and Chris for the idea behind this,
and extra thanks to Duncan for helping me work out the trap-safety.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48280 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
77db50f68f9fa5cade9f3a368af4722a76e0c8c5 27-Feb-2008 Owen Anderson <resistor@mac.com> Fix an issue where GVN had the sizes of the two memcpy's reverse, resulting
in an invalid transformation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47639 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c0808a7e1d91fb5362ba52101bf8ebcebcb7bfb6 25-Feb-2008 Owen Anderson <resistor@mac.com> Fix an issue where GVN was performing the return slot optimization when it was
not safe. This is fixed by more aggressively checking that the return slot is
not used elsewhere in the function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47544 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0f7ea1ab106ffb3c8e23a87c0687f85132d93ca1 25-Feb-2008 Owen Anderson <resistor@mac.com> Fix an issue where GVN would try to use an instruction before its definition when performing return slot optimization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47541 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
07e6e56f57e8781a8d7bc601cc9034a3741d84c2 20-Feb-2008 Anton Korobeynikov <asl@math.spbu.ru> Make Transforms to be 4.3 warnings-clean


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47371 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
61d30a821f372ca4185fc518023f857fbcb9c0f5 20-Feb-2008 Owen Anderson <resistor@mac.com> When performing return slot optimization, remember to inform memdep when we're removing the memcpy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
967552e7ec48007b3bb22608134a24f2de490a6e 19-Feb-2008 Owen Anderson <resistor@mac.com> Refactor this method a bit, and correct a test that was completely wrong but happened to work out anyways. :-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47321 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e42ce73c3737a8e49339c74a8c4c76ab8394947f 19-Feb-2008 Chris Lattner <sabre@nondot.org> isa+cast -> dyncast.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47320 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0a76a621a44b23be753cc8d41c3513f401d47833 19-Feb-2008 Chris Lattner <sabre@nondot.org> simplify this code again, try 2 :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47319 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9cffa9a6ed754a480dc73db0e8a5b0d846ba2dde 19-Feb-2008 Owen Anderson <resistor@mac.com> Fix a comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47318 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
61c24e96b1ee5245e0b382a35773d2bc41919880 19-Feb-2008 Owen Anderson <resistor@mac.com> Major improvements to yesterday's return slot optimization. Remove some unneccessary constraints,
and add some others that should have been in from the first place. Document the whole thing better.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47315 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
fa113f815513414a874c5801a5b4dc0ef7dfe8ef 19-Feb-2008 Owen Anderson <resistor@mac.com> Factor the profitability check for return slot optimization out into a static function.
At some point in the future, this check will become smarter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c0755a6f984f17c269c2a7a4b48c74d201403c9b 19-Feb-2008 Owen Anderson <resistor@mac.com> An sret parameter is required to be the first parameter, so there's no need to loop
over all the parameters of the callee looking for it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47309 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
7acc0af95a81030b1f7811d9183e00b875415cfc 19-Feb-2008 Owen Anderson <resistor@mac.com> Cleanup some of my patches from yesterday. Refactor the check for which xform
to apply to a memcpy into processInstruction. Also, fix a bug in the check due to
missing braces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47307 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
c2580ab9b03fa703f03ad1c171d581c9d9ea6de6 19-Feb-2008 Owen Anderson <resistor@mac.com> Fix Transforms/GVN/memcpy.ll, which Chris broke in r47275 by reordering the branches. memcpy's are a kind of CallInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47305 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
913b19f6fc697c70d456f596d48258a87ebea6be 18-Feb-2008 Chris Lattner <sabre@nondot.org> minor code simplification, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47275 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5aa4f2a0857563b4ad9115c614afed9501aa58f4 18-Feb-2008 Owen Anderson <resistor@mac.com> Add support to GVN for performing sret return slot optimization. This means that, if an sret function tail calls
another sret function, it should pass its own sret parameter to the tail callee, allowing it to fill in the correct
return value. llvm-gcc does not emit this by default. Instead, it allocates space in the caller for the sret of
the tail call and then uses memcpy to copy the result into the caller's sret parameter. This optimization detects
and optimizes that case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47265 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
95f0ba2703b2a49fb6f2373703fb42915774ee94 14-Feb-2008 Nick Lewycky <nicholas@mxc.ca> Fix PR2032. Inform the alias analysis of changes to the underlying program.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47111 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
30b4bd4d1099764db4f1e1a955b7f7cc9dafdd97 12-Feb-2008 Owen Anderson <resistor@mac.com> Re-apply the patch to improve the optimizations of memcpy's, with several
bugs fixed. This now passes PPC bootstrap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b6c36e405899a9bc3ac526b27c6db1f44fec69d4 12-Feb-2008 Eli Friedman <eli.friedman@gmail.com> Fix for bug 1996: optimize out loads of undef. This code basically just
checks for a malloc/alloca immediately followed by a load.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
e00fec554bcf6c853a89e82de8dc431415e9b394 06-Feb-2008 Bill Wendling <isanbard@gmail.com> Temporarily reverting:

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080128/057882.html

This is causing a miscompilation on PPC G5 and just now seeing it on iMac x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46822 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
6f7a52d300617fd2aca4cd48e328cfe7904be006 04-Feb-2008 Owen Anderson <resistor@mac.com> Allow GVN to hack on memcpy's, making them open to further optimization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4ee451de366474b9c228b4e5fa573795a715216d 29-Dec-2007 Chris Lattner <sabre@nondot.org> Remove attribution from file headers, per discussion on llvmdev.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
5fc4abac3db46b6e6b3824163c0f1252c1ab0ebb 08-Dec-2007 Owen Anderson <resistor@mac.com> Fix several cache coherence bugs in MemDep/GVN that were found. Also add some (disabled) debugging code
to make such problems easier to diagnose in the future, written by Duncan Sands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44695 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
dff6710717b159f089c76a07eda074eb6347eb92 01-Dec-2007 Duncan Sands <baldrick@free.fr> Integrate the readonly/readnone logic more deeply
into alias analysis. This meant updating the API
which now has versions of the getModRefBehavior,
doesNotAccessMemory and onlyReadsMemory methods
which take a callsite parameter. These should be
used unless the callsite is not known, since in
general they can do a better job than the versions
that take a function. Also, users should no longer
call the version of getModRefBehavior that takes
both a function and a callsite. To reduce the
chance of misuse it is now protected.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44487 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1fb136464deda4feb6724c9874d17eb4867633c0 29-Nov-2007 Owen Anderson <resistor@mac.com> Fix a miscompilation in spiff on PPC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44437 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a16bbc9aa77c9e22a67e9b0a8be17321990a7ccc 26-Nov-2007 Owen Anderson <resistor@mac.com> Fix another bug that was causing siod to fail.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44325 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
00a6d1448d27b5140b911caf2eca9585abdae5c8 26-Nov-2007 Owen Anderson <resistor@mac.com> Allow GVN to eliminate read-only function calls when it can detect that they are redundant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b388ca9544f66899ad7f6be665e2bc7529888254 18-Oct-2007 Owen Anderson <resistor@mac.com> Allow GVN to eliminate redundant calls to functions without side effects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43147 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
ce4d88aa644647a21f75f86cd26476fa3f23b396 21-Sep-2007 Owen Anderson <resistor@mac.com> Add partial caching of non-local memory dependence queries. This provides a modest
speedup for GVN.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42185 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
76c1b97e4020faace8c95a127f1eab66c278fb58 17-Sep-2007 Chris Lattner <sabre@nondot.org> Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfo

Add a new DenseMapInfo::isEqual method to allow clients to redefine
the equality predicate used when probing the hash table.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2486686689af91c02357fd0925ed213e4dfe0ed1 16-Sep-2007 Owen Anderson <resistor@mac.com> Be more careful when constant-folding PHI nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41998 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1defe2df5d563e519ae5dd6c19d9519f0abddbfc 17-Aug-2007 Owen Anderson <resistor@mac.com> Factor out some code into a helper function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
62bc33c954591039fa134fa251d570a2032cfa74 17-Aug-2007 Owen Anderson <resistor@mac.com> Add some more comments to GVN.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41129 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
31f496755a421a4bc0d07e7c927a14ee50d58763 14-Aug-2007 Owen Anderson <resistor@mac.com> Eliminate PHI nodes with constant values during normal GVN processing, even when
they're not related to eliminating a load.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41081 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
36057c7834e54d4326bcdc9d182036b2ffa2aa3d 14-Aug-2007 Owen Anderson <resistor@mac.com> Be more aggressive in pruning unnecessary PHI nodes when doing PHI construction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41080 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
3e75a42ee2375ad2ab3fac66777b04a71bc930c8 14-Aug-2007 Owen Anderson <resistor@mac.com> Make GVN iterative.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41078 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8e8278e7fe66e5cf3f82f7f9b0486699f5ba3cc9 14-Aug-2007 Owen Anderson <resistor@mac.com> Fix a case where GVN was failing to return true when it had, in fact, modified
the function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41077 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9528f11481e6840a10442733f1dc45c04b79d596 09-Aug-2007 Owen Anderson <resistor@mac.com> Make NonLocal and None const in the right way. :-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40961 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
8cad423d94fd7e30d84742311c454016f36e3ee3 08-Aug-2007 Owen Anderson <resistor@mac.com> Change the None and NonLocal markers in memdep to be const.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40946 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
a37226af81bf10ba9f23ef065d8efc58877d3dc3 08-Aug-2007 Owen Anderson <resistor@mac.com> Don't insert nearly as many redundant phi nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40909 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
ab8702787d6bcdeaea31fc6a3d4a7fec3a5e18c4 03-Aug-2007 Owen Anderson <resistor@mac.com> Fix a subtle miscompilation. This allows 197.parser to be compiled correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40791 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4b55c3b0f17cdf548e45899ba069e454c6342bf1 03-Aug-2007 Owen Anderson <resistor@mac.com> Fix a subtle iterator invalidation bug in a recursive algorithm.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
830db6a00e446220fb31f97f116002db147b3f89 02-Aug-2007 Owen Anderson <resistor@mac.com> Fix 80 col. violations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40750 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1c2763d3fe8b70d9b85cb84bbce311ee4b86c9e1 02-Aug-2007 Owen Anderson <resistor@mac.com> Fix a bug that was causing several miscompilations on SPEC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40746 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9066020993695a690c1f979f9cac4e14d325e237 02-Aug-2007 Owen Anderson <resistor@mac.com> Make non-local memdep not be recursive, and fix a bug on 403.gcc that this exposed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40692 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
bf7d0bc4e5ad0516c88b550945c9050920ece148 01-Aug-2007 Owen Anderson <resistor@mac.com> Don't let the memory allocator outsmart GVN. ;-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40655 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
b95f9d565f51a431449a2ae60211aa0e07709c6c 31-Jul-2007 Owen Anderson <resistor@mac.com> Fix a failure I accidentally caused in my last commit by mishandling the
removal of redundant phis.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40650 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
054ab94bff7827b8004465b75dfe0d539568621a 31-Jul-2007 Owen Anderson <resistor@mac.com> Fix a misoptimization in aha.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
891eecb040b26426fdb31499939eb1916ce6bf8d 30-Jul-2007 Owen Anderson <resistor@mac.com> Avoid potential iterator invalidation problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40607 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
45c8388e2a94502ded17dc493fe3fb10b04ce439 30-Jul-2007 Owen Anderson <resistor@mac.com> Use more caching when computing non-local dependence. This makes bzip2 not
use up the entire 32-bit address space.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40596 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
4f9ba7c40c41cae3d9730c5416a2750dea4f0ff4 30-Jul-2007 Owen Anderson <resistor@mac.com> Fix a bug caused by indiscriminantly asking for the dominators of a predecessor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40595 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
45537917eec15e5c3ef75c0ee2bf8963b02f3a54 26-Jul-2007 Owen Anderson <resistor@mac.com> Fix a couple more bugs in the phi construction by pulling in code that does
almost the same things from LCSSA.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40540 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
febc7e3613007a159943917734baa35cc1b1411d 26-Jul-2007 Owen Anderson <resistor@mac.com> Fix what is _hopefully_ the last corner case for loops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
9f435740b1c652926c80529e00c92925a3196d79 26-Jul-2007 Owen Anderson <resistor@mac.com> My last commit was not correct for nested loops. Fix it, and add a testcase for it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40498 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0d16988690c44f2d7b3983dbf56739d83fb5fdfe 26-Jul-2007 Owen Anderson <resistor@mac.com> Fix an infinite loop on 300.twolf.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40497 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
2e3d6b4a273f12a9121a040da1f9dcdccf88cba1 25-Jul-2007 Owen Anderson <resistor@mac.com> Fix a bug that was causing GVN to crash on 252.eon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
0cd320362e91852c8f7f2c8c4841498aab7f92fa 25-Jul-2007 Owen Anderson <resistor@mac.com> Add basic support for performing whole-function RLE.
Note: This has not yet been thoroughly tested. Use at your own risk.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40489 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp
1ad2cb75553a30bcec9fdc15733a20df6bc50431 24-Jul-2007 Owen Anderson <resistor@mac.com> Add a GVN pass, using the value numbering code I developed for GVNPRE and the
load elimination code from RedundantLoadElimination.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/Scalar/GVN.cpp