History log of /external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cd81d94322a39503e4a3e87b6ee03d4fcb3465fb 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/IPO/GlobalOpt.cpp
dce4a407a24b04eebc6a376f8e62b41aaa7b071f 29-May-2014 Stephen Hines <srhines@google.com> Update LLVM for 3.5 rebase (r209712).

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

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
dd36ddfaec578968b163fc4bbb7148921084aa6e 14-Dec-2013 Bill Wendling <isanbard@gmail.com> Merging r197178:
------------------------------------------------------------------------
r197178 | hfinkel | 2013-12-12 12:45:24 -0800 (Thu, 12 Dec 2013) | 9 lines

Fix a use-after-free error in GlobalOpt CleanupConstantGlobalUsers

GlobalOpt's CleanupConstantGlobalUsers function uses a worklist array to manage
constant users to be visited. The pointers in this array need to be weak
handles because when we delete a constant array, we may also be holding a
pointer to one of its elements (or an element of one of its elements if we're
dealing with an array of arrays) in the worklist.

Fixes PR17347.
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@197322 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6f744ee498357155d3b0b6466b2f34a785c9c435 04-Nov-2013 Shuxin Yang <shuxin.llvm@gmail.com> Remove dead code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
69bd41dfe33f24414be281ba5e2204b7348c33ae 27-Oct-2013 Shuxin Yang <shuxin.llvm@gmail.com> Revert r193251 : Use address-taken to disambiguate global variable and indirect memops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193489 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8e3851a6eb9fe5fc30094c3a00d2b89c7cd68cbd 23-Oct-2013 Shuxin Yang <shuxin.llvm@gmail.com> Use address-taken to disambiguate global variable and indirect memops.

Major steps include:
1). introduces a not-addr-taken bit-field in GlobalVariable
2). GlobalOpt pass sets "not-address-taken" if it proves a global varirable
dosen't have its address taken.
3). AA use this info for disambiguation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193251 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
713cab059ebb67c2f51d8da9d8e57be2b1dcd9c2 21-Oct-2013 Rafael Espindola <rafael.espindola@gmail.com> Optimize more linkonce_odr values during LTO.

When a linkonce_odr value that is on the dso list is not unnamed_addr
we can still look to see if anything is actually using its address. If
not, it is safe to hide it.

This patch implements that by moving GlobalStatus to Transforms/Utils
and using it in Internalize.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193090 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b75fcecb0ff2f22e79454ce9ed7c246792bdbf0d 17-Oct-2013 Rafael Espindola <rafael.espindola@gmail.com> Rename fields of GlobalStatus to match the coding style.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192910 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
9bb874cea257753349854106a994999981290259 17-Oct-2013 Rafael Espindola <rafael.espindola@gmail.com> rename SafeToDestroyConstant to isSafeToDestroyConstant and clang-format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192907 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
4a7cef2202893d74caf5aa817aa40d1a67c8de46 17-Oct-2013 Rafael Espindola <rafael.espindola@gmail.com> Simplify the interface of AnalyzeGlobal a bit and rename to analyzeGlobal.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192906 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
23eb90714bb6a5a7d94a262f439b5bf872733cf1 07-Oct-2013 Alexey Samsonov <samsonov@google.com> Revert r191834 until we measure the effect of this benchmarks and maybe find a better way to fix it

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192121 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6ffce6fa9295699078f81fabb9ca32f6f22bdf09 02-Oct-2013 Alexey Samsonov <samsonov@google.com> Remove "localize global" optimization

Summary:
As discussed in http://llvm-reviews.chandlerc.com/D1754,
this optimization isn't really valid for C, and fires too rarely anyway.

Reviewers: rafael, nicholas

Reviewed By: nicholas

CC: rnk, llvm-commits, nicholas

Differential Revision: http://llvm-reviews.chandlerc.com/D1769

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191834 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
0d293e45b66c742fdbc3998209bb20ed6c5806bf 22-Sep-2013 Benjamin Kramer <benny.kra@googlemail.com> Provide basic type safety for array_pod_sort comparators.

This makes using array_pod_sort significantly safer. The implementation relies
on function pointer casting but that should be safe as we're dealing with void*
here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191175 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
cf16bae9fe1b566e3f6a011df6805426767610b7 11-Sep-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Use type form of getIntPtrType

This doesn't change anything since malloc always returns
address space 0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190498 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b1c54930cb1450534d6f3f0ebd81eb1e042a3246 10-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Don't shrink atomic ops to bool in GlobalOpt.

LLVM IR doesn't currently allow atomic bool load/store operations, and the
transformation is dubious anyway because it isn't profitable on all platforms.

PR17163.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190357 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
466fa17aba4014d8ce1e42e9f5622f5b872949f3 05-Sep-2013 Rafael Espindola <rafael.espindola@gmail.com> Remove unused argument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190090 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
9718158222ad9c52b2fb14609a341d4e24def8bb 04-Sep-2013 Rafael Espindola <rafael.espindola@gmail.com> Revert "Add r159136 back now that pr13124 has been fixed."

This reverts commit r189886.

I found a corner case where this optimization is not valid:

Say we have a "linkonce_odr unnamed_addr" in two translation units:
* In TU 1 this optimization kicks in and makes it hidden.
* In TU 2 it gets const merged with a constant that is *not* unnamed_addr,
resulting in a non unnamed_addr constant with default visibility.
* The static linker rules for combining visibility them produce a hidden
symbol, which is incorrect from the point of view of the non unnamed_addr
constant.

The one place we can do this is when we know that the symbol is not used from
another TU in the same shared object, i.e., during LTO. I will move it there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189954 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
79869ee59abc3aeebda6e15540273a7e5936adb4 04-Sep-2013 Rafael Espindola <rafael.espindola@gmail.com> Add r159136 back now that pr13124 has been fixed.

Original message:
If a constant or a function has linkonce_odr linkage and unnamed_addr, mark
hidden. Being linkonce_odr guarantees that it is available in every dso that
needs it. Being a constant/function with unnamed_addr guarantees that the
copies don't have to be merged.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
4ef7eafa3f823443d1b8921f6020d946612281db 25-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Respect llvm.used in Internalize.

The language reference says that:

"If a symbol appears in the @llvm.used list, then the compiler,
assembler, and linker are required to treat the symbol as if there is
a reference to the symbol that it cannot see"

Since even the linker cannot see the reference, we must assume that
the reference can be using the symbol table. For example, a user can add
__attribute__((used)) to a debug helper function like dump and use it from
a debugger.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187103 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b97b1627316ef4a9eb7591ef4f814917ba054ff6 25-Jul-2013 Nick Lewycky <nicholas@mxc.ca> Check that TD isn't NULL before dereferencing it down this path.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
2d680824e3a5272e386aa6c1d2a66676de7899fd 25-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Make these methods const correct.

Thanks to Nick Lewycky for noticing it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
64f2f910bd48c123a6b5945ebe90b018f7bea4d5 21-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Don't crash when llvm.compiler.used becomes empty.

GlobalOpt simplifies llvm.compiler.used by removing any members that are also
in the more strict llvm.used. Handle the special case where llvm.compiler.used
becomes empty.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186778 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
70968319719fbfb00a58ebcf82b1e18ec04be5be 19-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> s/compiler_used/compiler.used/.

We were incorrectly using compiler_used instead of compiler.used. Unfortunately
the passes using the broken name had tests also using the broken name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
201cdb10049126ea740e47f1dab01612a93a5698 09-Jul-2013 Eli Bendersky <eliben@google.com> Fix comment


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185888 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
100fbdd06be7590b23c4707a98cd605bdb519498 12-Jun-2013 Rafael Espindola <rafael.espindola@gmail.com> Always remove an alias when we rename the target.

Should fix the dragonegg build bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183845 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
d1b6ca23b42ad8180780c0e714e9a900e04785b1 11-Jun-2013 Rafael Espindola <rafael.espindola@gmail.com> Change how globalopt handles aliases in llvm.used.

Instead of a custom implementation of replaceAllUsesWith, we just call
replaceAllUsesWith and recreate llvm.used and llvm.compiler-used.

This change is particularity interesting because it makes llvm see
through what clang is doing with static used functions in extern "C"
contexts. With this change, running clang -O2 in

extern "C" {
__attribute__((used)) static void foo() {}
}

produces

@llvm.used = appending global [1 x i8*] [i8* bitcast (void ()* @foo to
i8*)], section "llvm.metadata"
define internal void @foo() #0 {
entry:
ret void
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
5150270d071f05c6ea1fd26ef448954ddb5746dc 14-May-2013 Manman Ren <mren@apple.com> GlobalOpt: fix an issue where CXAAtExitFn points to a deleted function.

CXAAtExitFn was set outside a loop and before optimizations where functions
can be deleted. This patch will set CXAAtExitFn inside the loop and after
optimizations.

Seg fault when running LTO because of accesses to a deleted function.
rdar://problem/13838828


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181838 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
95f885390bff8ff2d0c5eb33e6bc3bd536c1594f 09-May-2013 Rafael Espindola <rafael.espindola@gmail.com> Don't replace an alias in llvm.used with its target.

When we replace an internal alias with its target, be careful not to
replace the entry in llvm.used (and llvm.compiler_used).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181524 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
2b7923665d628c247fcc50c52d7e0618359491c6 02-Apr-2013 Bill Wendling <isanbard@gmail.com> Use a worklist to avoid a sneaky iterator invalidation.

The iterator could be invalidated when it's recursively deleting a whole bunch
of constant expressions in a constant initializer.

Note: This was only reproducible if `opt' was run on a `.bc' file. If `opt' was
run on a `.ll' file, it wouldn't crash. This is why the test first pushes the
`.ll' file through `llvm-as' before feeding it to `opt'.

PR15440


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178531 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
17fe48ce6ee694eb1fb29804f4cba3dbea5e9248 14-Feb-2013 Bill Wendling <isanbard@gmail.com> Retain the name of the new internal global that's been shrunk.

It's possible (e.g. after an LTO build) that an internal global may be used for
debugging purposes. If that's the case appending a '.b' to it makes it hard to
find that variable. Steal the name from the old GV before deleting it so that
they can find that variable again.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175104 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8e47daf2858e980210f3e1f007036b24da342c29 26-Jan-2013 Bill Wendling <isanbard@gmail.com> Remove some introspection functions.

The 'getSlot' function and its ilk allow introspection into the AttributeSet
class. However, that class should be opaque. Allow access through accessor
methods instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173522 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
85875647d6f85cbcbe506809640b9857eaaa26a4 25-Jan-2013 Bill Wendling <isanbard@gmail.com> Use the new 'getSlotIndex' method to retrieve the attribute's slot index.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173499 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8246df61f6de716acf1f8c64fac3c19970a2c174 23-Jan-2013 Bill Wendling <isanbard@gmail.com> Use the AttributeSet when removing multiple attributes. Use Attribute::AttrKind
when removing one attribute. This further encapsulates the use of the attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173214 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
0813589f72de5f15a28f36e2235cb933b7b8ebc0 12-Jan-2013 Benjamin Kramer <benny.kra@googlemail.com> GlobalOpt: Avoid jump on uninitialized value.

Found by valgrind.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172318 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
dcf669560e2ae00c5392474d10aa758a51c609a8 12-Jan-2013 Michael Gottesman <mgottesman@apple.com> Fixed whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172271 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
cddd8a613e377e3064a2e7ca1d7ac8cb25f9b849 11-Jan-2013 Michael Gottesman <mgottesman@apple.com> Added debug messages to GlobalOpt.

Specifically:
1. Added a missing new line when we emit a debug message saying that we are marking a global variable as constant.
2. Added debug messages that describe what is occuring when GlobalOpt is evaluating a block/function.
3. Added a debug message that says what specific constructor is being evaluated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172247 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
1d505a33f9cb77a2adb644b85136e7be64a186d9 10-Jan-2013 Joey Gouly <joey.gouly@arm.com> Fix TryToShrinkGlobalToBoolean in GlobalOpt, so that it does not discard address spaces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172051 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
034b94b17006f51722886b0f2283fb6fb19aca1f 19-Dec-2012 Bill Wendling <isanbard@gmail.com> Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170502 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
99faa3b4ec6d03ac7808fe4ff3fbf3d04e375502 08-Dec-2012 Bill Wendling <isanbard@gmail.com> s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169651 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
5b4af8b52af2cb9e15c89a0e01686f2ed9127d86 06-Dec-2012 Jakub Staszak <kubastaszak@gmail.com> Remove unused field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169551 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
582088c088140845c73a15067a679e69c18984d0 06-Dec-2012 Jakub Staszak <kubastaszak@gmail.com> Remove trailing spaces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169550 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
efcdb2944bb81519c839feef3a83feed35552393 01-Dec-2012 Zhou Sheng <zhousheng00@gmail.com> Revert previous check in r168581, r169079 as they are still in code review status.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169083 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
702aa2ee19132593b552d211c985aa540787c197 01-Dec-2012 Zhou Sheng <zhousheng00@gmail.com> The patch is to improve the memory footprint of pass GlobalOpt.
Also check in a case to repeat the issue, on which 'opt -globalopt' consumes 1.6GB memory.
The big memory footprint cause is that current GlobalOpt one by one hoists and stores the leaf element constant into the global array, in each iteration, it recreates the global array initializer constant and leave the old initializer alone. This may result in many obsolete constants left.
For example: we have global array @rom = global [16 x i32] zeroinitializer
After the first element value is hoisted and installed: @rom = global [16 x i32] [ 1, 0, 0, ... ]
After the second element value is installed: @rom = global [16 x 32] [ 1, 2, 0, 0, ... ] // here the previous initializer is obsolete
...
When the transform is done, we have 15 obsolete initializers left useless.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169079 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
1839858983dcbaf1808a6a37f5cd64d92981f27e 15-Nov-2012 Hans Wennborg <hans@hanshq.net> Make GlobalOpt be conservative with TLS variables (PR14309)

For global variables that get the same value stored into them
everywhere, GlobalOpt will replace them with a constant. The problem is
that a thread-local GlobalVariable looks like one value (the address of
the TLS var), but is different between threads.

This patch introduces Constant::isThreadDependent() which returns true
for thread-local variables and constants which depend on them (e.g. a GEP
into a thread-local array), and teaches GlobalOpt not to track such
values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168037 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
ece6c6bb6329748b92403c06ac87f45c43485911 01-Nov-2012 Chandler Carruth <chandlerc@gmail.com> Revert the series of commits starting with r166578 which introduced the
getIntPtrType support for multiple address spaces via a pointer type,
and also introduced a crasher bug in the constant folder reported in
PR14233.

These commits also contained several problems that should really be
addressed before they are re-committed. I have avoided reverting various
cleanups to the DataLayout APIs that are reasonable to have moving
forward in order to reduce the amount of churn, and minimize the number
of commits that were reverted. I've also manually updated merge
conflicts and manually arranged for the getIntPtrType function to stay
in DataLayout and to be defined in a plausible way after this revert.

Thanks to Duncan for working through this exact strategy with me, and
Nick Lewycky for tracking down the really annoying crasher this
triggered. (Test case to follow in its own commit.)

After discussing with Duncan extensively, and based on a note from
Micah, I'm going to continue to back out some more of the more
problematic patches in this series in order to ensure we go into the
LLVM 3.2 branch with a reasonable story here. I'll send a note to
llvmdev explaining what's going on and why.

Summary of reverted revisions:

r166634: Fix a compiler warning with an unused variable.
r166607: Add some cleanup to the DataLayout changes requested by
Chandler.
r166596: Revert "Back out r166591, not sure why this made it through
since I cancelled the command. Bleh, sorry about this!
r166591: Delete a directory that wasn't supposed to be checked in yet.
r166578: Add in support for getIntPtrType to get the pointer type based
on the address space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167221 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
46d5dd9b058f31637f2449b2925f13a5707d126d 16-Oct-2012 Bill Wendling <isanbard@gmail.com> Use the Attributes::get method which takes an AttrVal value directly to simplify the code a bit. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
702cc91aa1bd41540e8674921ae7ac89a4ff061f 15-Oct-2012 Bill Wendling <isanbard@gmail.com> Move the Attributes::Builder outside of the Attributes class and into its own class named AttrBuilder. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165960 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
cb3de0bc800d7920087b19bb12a545d4cc84114e 15-Oct-2012 Bill Wendling <isanbard@gmail.com> Attributes Rewrite

Convert the internal representation of the Attributes class into a pointer to an
opaque object that's uniqued by and stored in the LLVMContext object. The
Attributes class then becomes a thin wrapper around this opaque
object. Eventually, the internal representation will be expanded to include
attributes that represent code generation options, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165917 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
5886b7bfc82385dfd35b7602304c86075e1d72e6 14-Oct-2012 Bill Wendling <isanbard@gmail.com> Remove the bitwise NOT operator from the Attributes class. Replace it with the equivalent from the builder class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7d2f2496c1d263eecdc104fd72e847a31d8695b9 10-Oct-2012 Bill Wendling <isanbard@gmail.com> Remove the final bits of Attributes being declared in the Attribute
namespace. Use the attribute's enum value instead. No functionality change
intended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6765834754cbb3cb0f15b4b15e98c5e73fa50066 09-Oct-2012 Bill Wendling <isanbard@gmail.com> Create enums for the different attributes.

We use the enums to query whether an Attributes object has that attribute. The
opaque layer is responsible for knowing where that specific attribute is stored.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165488 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
b44e3ee1a7af03062706cfa22ef4c0e57dfddca7 04-Oct-2012 Bill Wendling <isanbard@gmail.com> Use method to query for attributes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165209 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
ab16423c912a7baa73f36e9032365925914487a3 28-Sep-2012 Benjamin Kramer <benny.kra@googlemail.com> GlobalOpt: non-constexpr bitcasts or GEPs can occur even if the global value is only stored once.

Fixes PR13968.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164815 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
94c22716d60ff5edf6a98a3c67e0faa001be1142 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164767

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164768 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7e2c793a2b5c746344652b6579e958ee42fafdcc 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Fix a typo 'iff' => 'if'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164767 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
b8cd66b5d78eaeba41ab372aaca5180dd54e4385 25-Jul-2012 Nick Lewycky <nicholas@mxc.ca> It's not safe to blindly remove invoke instructions. This happens when we
encounter an invoke of an allocation function. This should fix the dragonegg
bootstrap. Testcase to follow, later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160757 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
952f5d562c40bc19147df4fbf3415069659236d1 24-Jul-2012 Nick Lewycky <nicholas@mxc.ca> Don't delete one more instruction than we're allowed to. This should fix the
Darwin bootstrap. Testcase exists but isn't fully reduced, I expect to commit
the testcase this evening.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8899d5c6fb3cf118c5c73eade290b6ebb2b3b850 24-Jul-2012 Nick Lewycky <nicholas@mxc.ca> Teach globalopt to not nuke all stores to globals. Keep them around of they
might be deliberate "one time" leaks, so that leak checkers can find them.
This is a reapply of r160602 with the fix that this time I'm committing the
code I thought I was committing last time; the I->eraseFromParent() goes
*after* the break out of the loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160664 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c7088c9a9cc37a5dce54def94f8c347922e0631c 21-Jul-2012 Nick Lewycky <nicholas@mxc.ca> Revert r160602.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160603 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
61e2ff8f821beec2eefdbb21a5954f74b1c0a295 21-Jul-2012 Nick Lewycky <nicholas@mxc.ca> Teach globalopt to play nice with leak checkers. This is a reapplication of
r160529 that was subsequently reverted. The fix was to not call
GV->eraseFromParent() right before the caller does the same. The existing
testcases already caught this bug if run under valgrind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160602 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
4a96d0e44bd691759f0d4d4f8be9b47cb64d7f64 20-Jul-2012 Nick Lewycky <nicholas@mxc.ca> Revert r160529 due to crashes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160532 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
39e357fafe074babbd9661f3e78239f5ebe7c429 20-Jul-2012 Nick Lewycky <nicholas@mxc.ca> Don't wipe out global variables that are probably storing pointers to heap
memory. This makes clang play nice with leak checkers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160529 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b2fe7f183d54d7e93880c8a472e0145e13dce070 02-Jul-2012 Duncan Sands <baldrick@free.fr> GlobalOpt forgot to handle bitcast when analyzing globals. Found by inspection.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159546 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
06b8c285d387d413e51108abea5168d7dc1d97b7 27-Jun-2012 Matt Beaumont-Gay <matthewbg@google.com> Revert r159136 due to PR13124.

Original commit message:

If a constant or a function has linkonce_odr linkage and unnamed_addr, mark it
hidden. Being linkonce_odr guarantees that it is available in every dso that
needs it. Being a constant/function with unnamed_addr guarantees that the
copies don't have to be merged.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159272 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a0706a9ff4469b137ed6eea3f484a0152bab4c88 25-Jun-2012 Rafael Espindola <rafael.espindola@gmail.com> If a constant or a function has linkonce_odr linkage and unnamed_addr, mark it
hidden. Being linkonce_odr guarantees that it is available in every dso that
needs it. Being a constant/function with unnamed_addr guarantees that the
copies don't have to be merged.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
3eab3c4d40e381d2c2eed93a423cb67e97ad718f 24-Jun-2012 Nick Lewycky <nicholas@mxc.ca> Tab to spaces. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159104 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
ce718ff9f42c7da092eaa01dd0242e8d5ba84713 23-Jun-2012 Hans Wennborg <hans@hanshq.net> Extend the IL for selecting TLS models (PR9788)

This allows the user/front-end to specify a model that is better
than what LLVM would choose by default. For example, a variable
might be declared as

@x = thread_local(initialexec) global i32 42

if it will not be used in a shared library that is dlopen'ed.

If the specified model isn't supported by the target, or if LLVM can
make a better choice, a different model may be used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159077 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
cd88efe516510d3413c0e880217779e3eb56e956 22-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> fix whitespace in my last commit.
sorry for the churn :S enough for today; going to sleep.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158953 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
eb7c6865cd8d44a882aa7c3e10e1d976f333344f 22-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> remove extractMallocCallFromBitCast, since it was tailor maded for its sole user. Update GlobalOpt accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158952 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
2f135d4c14d26d00deaa72fd0f36731968161e5e 15-Jun-2012 Rafael Espindola <rafael.espindola@gmail.com> Some optimizations done by globalopt are safe only for internal linkage, not
linkonce linkage. For example, it is not valid to add unnamed_addr.

This also fixes a crash in g++.dg/opt/static5.C.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158528 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
0397729d3b8da4208660a163d18296b1a3bd32b8 15-Jun-2012 Rafael Espindola <rafael.espindola@gmail.com> Implement the isSafeToDiscardIfUnused predicate and use it in globalopt and
globaldce. Globaldce was already removing linkonce globals, but globalopt was
not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158476 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b7454fd9df0b477e3daf2fce6e1d5e1b241562df 12-May-2012 Jay Foad <jay.foad@gmail.com> Teach Function::hasAddressTaken that BlockAddress doesn't really take
the address of a function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156703 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c1ea16ec4339a9746f436c6f2f5b08197f309343 28-Mar-2012 Benjamin Kramer <benny.kra@googlemail.com> GlobalOpt: If we have an inbounds GEP from a ConstantAggregateZero global that we just determined to be constant, replace all loads from it with a zero value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153576 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
f1ce79f3c359bf33c2f30a74625a9babc3cc2a48 13-Mar-2012 Dan Gohman <gohman@apple.com> Teach globalopt how to evaluate an invoke with a non-void return type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
3bbf2b6548340bb9218836f991da8c3a4718f6db 27-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Plog a memleak in GlobalOpt.

Found by valgrind.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151525 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
4b794f81917d2799225a9d1951729f1798431f81 23-Feb-2012 Duncan Sands <baldrick@free.fr> GCC fails to understand that NextBB is always initialized if EvaluateBlock
returns 'true' and emits a warning. Help it out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151242 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a641c07828fe4e836d680b9e8b0b4af3204b8b97 21-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Use the target-aware constant folder on expressions to improve the chance
they'll be simple enough to simulate, and to reduce the chance we'll encounter
equal but different simple pointer constants.

This removes the symptoms from PR11352 but is not a full fix. A proper fix would
either require a guarantee that two constant objects we simulate are folded
when equal, or a different way of handling equal pointers (ie., trying a
constantexpr icmp on them to see whether we know they're equal or non-equal or
unsure).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151093 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
0ef0557ab5cd11f56c16e82551d4f3b58bb2507a 21-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Check for the correct size in the invariant marker.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7fa767770574ba0312165ac9ed08f792b8fb7874 20-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Rename class Evaluate to Evaluator and put it in an anonymous namespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150947 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
23ec5d7759ed9a3b52fc8c470695248a1719cce8 20-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Move EvaluateFunction and EvaluateBlock into a class, and make the class store
the information that they pass around between them. No functionality change!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
81266c5c9358d71331886a98e750ac9409cc640c 17-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Add support for invariant.start inside the static constructor evaluator. This is
useful to represent a variable that is const in the source but can't be constant
in the IR because of a non-trivial constructor. If globalopt evaluates the
constructor, and there was an invariant.start with no matching invariant.end
possible, it will mark the global constant afterwards.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150794 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
132bd9ce56e1f6d0231c34acec738a8bc92c9cfa 12-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Handle InvokeInst in EvaluateBlock. Don't try to support exceptions, it's just
that no optz'ns have run yet to convert invokes to calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150326 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6f160d3d78c1b7839b6bc053339e1fdfbf0276de 12-Feb-2012 Nick Lewycky <nicholas@mxc.ca> false is totally null!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150324 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6a7df9aae620801d97da72d718e9aff76eebac9b 12-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Remove redundant getAnalysis<> calls in GlobalOpt. Add a few Itanium ABI calls
to TargetLibraryInfo and use one of them in GlobalOpt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6a577f82ba56a4da48e984702240a01c3ba7e941 12-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Pass TargetData and TargetLibraryInfo through to the constant folder. Fixes a
few fixme's when TLI was added.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150322 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
db292a6f7ffe410913255f65e195004327e2e0ce 12-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Fix function name in comment to match actual name. Fix comments that are using
doxy-style on local variables to not do so. Fix one 80-col violation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150320 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8e4ba6b954d58bd60b342770dfca62de4cf4eb6e 12-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Don't traverse the PHI nodes twice. No functionality change!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150319 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c1322a13b5b3a4e4f5017deeb27d85ac41f7a839 09-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Tweak comment readability and grammar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150183 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
d4692747439aac1fbc2064e11b53e3e6ea5ad463 09-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> GlobalOpt: Be more aggressive about elminating side-effect free static dtors.

GlobalOpt runs early in the pipeline (before inlining) and complex class
hierarchies often introduce bitcasts or GEPs which weren't optimized away.
Teach it to ignore side-effect free instructions instead of depending on
other passes to remove them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150174 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
da82fd411ec37bc81a1e584d2f3163aeda4d2e95 06-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Split part of EvaluateFunction into a new EvaluateBlock method. No functionality
change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
fad4d40f3792b0d9e101c40738e1f691131007d2 05-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Teach GlobalOpt to handle atomic accesses to globals.

* Most of the transforms come through intact by having each transformed load or
store copy the ordering and synchronization scope of the original.
* The transform that turns a global only accessed in main() into an alloca
(since main is non-recursive) with a store of the initial value uses an
unordered store, since it's guaranteed to be the first thing to happen in main.
(Threads may have started before main (!) but they can't have the address of a
function local before the point in the entry block we insert our code.)
* The heap-SRoA transforms are disabled in the face of atomic operations. This
can probably be improved; it seems odd to have atomic accesses to an alloca
that doesn't have its address taken.

AnalyzeGlobal keeps track of the strongest ordering found in any use of the
global. This is more information than we need right now, but it's cheap to
compute and likely to be useful.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149847 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
bc384a1feb08141691ef994a7d11a506e89c5a62 05-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Clean up some whitespace and comments. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149845 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
a78fa8cc2dd6d2ffe5e4fe605f38aae7b3d2fb7a 27-Jan-2012 Chris Lattner <sabre@nondot.org> continue making the world safe for ConstantDataVector. At this point,
we should (theoretically optimize and codegen ConstantDataVector as well
as ConstantVector.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149116 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
d59ae907eea28285ece6696d6f3271b4ca578c0d 26-Jan-2012 Chris Lattner <sabre@nondot.org> Continue improving support for ConstantDataAggregate, and use the
new methods recently added to (sometimes greatly!) simplify code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a1f00f4d488eb5daff52faaf99c62ee652fd3b85 25-Jan-2012 Chris Lattner <sabre@nondot.org> use Constant::getAggregateElement to simplify a bunch of code.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148934 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
4d6ccb5f68cd7c6418a209f1fa4dbade569e4493 20-Jan-2012 David Blaikie <dblaikie@gmail.com> More dead code removal (using -Wunreachable-code)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
fb54ad19e7ef1b4f7177a005332ca8aca9bdbcb1 06-Jan-2012 Eli Friedman <eli.friedman@gmail.com> PR11705, part 2: globalopt shouldn't put inttoptr/ptrtoint operations into global initializers if there's an implied extension or truncation.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147625 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
aab8e28d5e470711d80276bbf717408c3ab966fd 02-Dec-2011 Chad Rosier <mcrosier@apple.com> Fix a few more places where TargetData/TargetLibraryInfo is not being passed.
Add FIXMEs to places that are non-trivial to fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145661 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
00737bdb488cc7157ca5f7a40d6cd8467ad09a79 01-Dec-2011 Chad Rosier <mcrosier@apple.com> Last bit of TargetLibraryInfo propagation. Also fixed a case for TargetData
where it appeared beneficial to pass.
More of rdar://10500969

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145630 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c66330504c3f433430a28cd7f7f981e555c51bce 20-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Refactor code from inlining and globalopt that checks whether a function definition is unused, and enhance it so it can tell that functions which are only used by a blockaddress are in fact dead. This probably doesn't happen much on most code, but the Linux kernel's _THIS_IP_ can trigger this issue with blockaddress. (GlobalDCE can also handle the given tescase, but we only run that at -O3.) Found while looking at PR11180.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
33cb445fb68589d59172e02253367cfae700d4b1 16-Aug-2011 Eli Friedman <eli.friedman@gmail.com> Minor comment fixes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
3d30b435e2b3d0e7480019577f48472b51133c21 16-Aug-2011 Eli Friedman <eli.friedman@gmail.com> Update inter-procedural optimizations for atomic load/store.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
dccc03b2423fe65efb5963ae816b99c24fc53374 31-Jul-2011 Bill Wendling <isanbard@gmail.com> Add the 'resume' instruction for the new EH rewrite.

This adds the 'resume' instruction class, IR parsing, and bitcode reading and
writing. The 'resume' instruction resumes propagation of an existing (in-flight)
exception whose unwinding was interrupted with a 'landingpad' instruction (to be
added later).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
10c6d12a9fd4dab411091f64db4db69670b88850 30-Jul-2011 Bill Wendling <isanbard@gmail.com> Revert r136253, r136263, r136269, r136313, r136325, r136326, r136329, r136338,
r136339, r136341, r136369, r136387, r136392, r136396, r136429, r136430, r136444,
r136445, r136446, r136253 pending review.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136556 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
772fe17a6d07304ae2e6b3052bbb24ebb751f0f3 27-Jul-2011 Bill Wendling <isanbard@gmail.com> Merge the contents from exception-handling-rewrite to the mainline.

This adds the new instructions 'landingpad' and 'resume'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a9203109f4ac95aa7e9624f2838e3d89623ec902 25-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert GetElementPtrInst to use ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b4263a6ff4f9696fc84a8f75b5d09564ff06381f 22-Jul-2011 Jay Foad <jay.foad@gmail.com> Fix more MSVC warnings caused by a cases I missed when converting
ConstantExpr::getGetElementPtr to use ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135762 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
4b5e207bf24ea9799547a0634acaf7398b32897c 21-Jul-2011 Jay Foad <jay.foad@gmail.com> Make better use of ConstantExpr::getGetElementPtr's InBounds parameter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135676 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
c30a38f34bdfecb99ce49e3ffa479039c9bf0209 21-Jul-2011 Chris Lattner <sabre@nondot.org> move tier out of an anonymous namespace, it doesn't make sense
to for it to be an an anon namespace and be in a header.

Eliminate some extraenous uses of tie.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135669 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
1d2f569c3428d70d0cf690c9adb459ad4a3ecff2 19-Jul-2011 Jay Foad <jay.foad@gmail.com> Use ArrayRef in ConstantFoldInstOperands and ConstantFoldCall.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
b065b06c12dba6001b8140df2744d0c856ef6ea1 20-Jun-2011 Chris Lattner <sabre@nondot.org> Revamp the "ConstantStruct::get" methods. Previously, these were scattered
all over the place in different styles and variants. Standardize on two
preferred entrypoints: one that takes a StructType and ArrayRef, and one that
takes StructType and varargs.

In cases where there isn't a struct type convenient, we now add a
ConstantStruct::getAnon method (whose name will make more sense after a few
more patches land).

It would be "really really nice" if the ConstantStruct::get and
ConstantVector::get methods didn't make temporary std::vectors.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133412 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
bcb85087a7f281dcc85b04f82be3a79ff9387fc5 29-May-2011 Nick Lewycky <nicholas@mxc.ca> Don't crash owhen ComputeLoadResult can't compute the result of the load.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132290 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
1f237b00279ada1ccce35ab924a7f797d9dea25d 29-May-2011 Nick Lewycky <nicholas@mxc.ca> Obey the isVolatile bit on memory intrinsics when analyzing uses of a global
variable. Noticed by inspection.

Simulate memset in EvaluateFunction where the target of the memset and the
value we're setting are both the null value. Fixes PR10047!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132288 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
98a42b2fc39f3fc46905fb98078cce4ce4e0a827 22-May-2011 Chris Lattner <sabre@nondot.org> fix PR9856, an incorrectly conservative assertion: a global can be
"stored once" even if its address is compared.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131849 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
5ea5c61589e62a1068746ddcc52c6aa39ec0f8b0 12-Apr-2011 Nick Lewycky <nicholas@mxc.ca> Just because a GlobalVariable's initializer is [N x { i32, void ()* }] doesn't
mean that it has to be ConstantArray of ConstantStruct. We might have
ConstantAggregateZero, at either level, so don't crash on that.

Also, semi-deprecate the sentinal value. The linker isn't aware of sentinals so
we end up with the two lists appended, each with their "sentinals" on them.
Different parts of LLVM treated sentinals differently, so make them all just
ignore the single entry and continue on with the rest of the list.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129307 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
562b84b3aea359d1f918184e355da82bf05eb290 11-Apr-2011 Jay Foad <jay.foad@gmail.com> Don't include Operator.h from InstrTypes.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129271 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
18a2e50a9bfe4ecde57dc3913a7bd98b954ec81a 09-Apr-2011 Eli Friedman <eli.friedman@gmail.com> Add back a couple checks removed by r129128; the fact that an intitializer
is an array of structures doesn't imply it's a ConstantArray of
ConstantStruct.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129207 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
2c44a80d991df258a45e2f5fa76d5ada9e99015c 08-Apr-2011 Nick Lewycky <nicholas@mxc.ca> llvm.global_[cd]tor is defined to be either external, or appending with an array
of { i32, void ()* }. Teach the verifier to verify that, deleting copies of
checks strewn about.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129128 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
807bc2a3814bb45b38702785ad9978153d176698 22-Mar-2011 Anders Carlsson <andersca@mac.com> Handle another case that Frits suggested.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128068 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b12caf31f43eefc399eb2584225924d22cfd5b28 21-Mar-2011 Anders Carlsson <andersca@mac.com> More cleanups to the OptimizeEmptyGlobalCXXDtors GlobalOpt function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127997 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
262a8627870c38f385944fc2ed9ae365347adf47 21-Mar-2011 Anders Carlsson <andersca@mac.com> As suggested by Nick Lewycky, ignore debugging intrinsics when trying to decide whether a destructor is empty or not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
35ee1c921c55ced16748b90c486c9feeb433c74b 21-Mar-2011 Nick Lewycky <nicholas@mxc.ca> Fix comments


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127984 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
4f735ca1855bb66974f3b1c4ee493534d5037eda 20-Mar-2011 Anders Carlsson <andersca@mac.com> Don't try to eliminate invokes to __cxa_atexit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127976 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
372ec6aa915534f3b11c252dbc9e6c63814bcab3 20-Mar-2011 Anders Carlsson <andersca@mac.com> Don't segfault on mutual recursion, as pointed out by Frits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127975 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
1f7c7ba380cf411fd02a070822c439fadac91ce6 20-Mar-2011 Anders Carlsson <andersca@mac.com> Address comments from Frits van Bommel.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127974 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a201c4c2e604a519665ca55dc49e913628444ddb 20-Mar-2011 Anders Carlsson <andersca@mac.com> Add an optimization to GlobalOpt that eliminates calls to __cxa_atexit, if the function passed is empty.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127970 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
2ca5c8644e6c35b3a7910a576ed89cddb7b82c3b 15-Feb-2011 Chris Lattner <sabre@nondot.org> convert ConstantVector::get to use ArrayRef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
75831904220042260c4faece8507a2807acba47f 14-Feb-2011 Chris Lattner <sabre@nondot.org> revert my ConstantVector patch, it seems to have made the llvm-gcc
builders unhappy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125504 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
283c8caccd093f8e1d4f0bdd01ac240b4edbd20a 14-Feb-2011 Chris Lattner <sabre@nondot.org> Switch ConstantVector::get to use ArrayRef instead of a pointer+size
idiom. Change various clients to simplify their code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125487 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c4440e3e307fb696146c08c127c53300a982fe82 19-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Add unnamed_addr when we can show that address of a global is not used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123834 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
daad56a8e3ac99c517d766130ac4ac03b578d180 18-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Reduce indentation and remove commented out code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123729 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
66f708f7e5f207d7a7ab259b70b5fd94795fb74c 16-Jan-2011 Owen Anderson <resistor@mac.com> Improve the safety of my globalopt enhancement by ensuring that the bitcast
of the stored value to the new store type is always. Also, add a testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123563 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
d5f656f48b98b4fc4dcb131f113316ba04180f11 16-Jan-2011 Chris Lattner <sabre@nondot.org> simplify this code, it is still broken but will follow up on llvm-commits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123558 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
bfa3b905822800c804ab55a7a2e7367b473d5504 15-Jan-2011 Benjamin Kramer <benny.kra@googlemail.com> Try to unbreak selfhost.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
e95a32ce40f8c189e939788a82fd54ca9280f973 14-Jan-2011 Owen Anderson <resistor@mac.com> Fix a false-positive warning.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123480 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
cff6b3772bd991119ff4882e06af29fbdb60e93f 14-Jan-2011 Owen Anderson <resistor@mac.com> Enhance GlobalOpt to be able evaluate initializers that involve stores through
bitcasts, at least in simple cases. This fixes clang's CodeGenCXX/virtual-base-dtor.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
d91ed10b7028c8470c8a9b7fa61a712d04ab07d9 01-Jan-2011 Chris Lattner <sabre@nondot.org> fix a globalopt crash on two Adobe-C++ testcases that the recent
loop idiom pass exposed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122674 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
1945d58025203aec7883c11ac51b827d440f6916 07-Dec-2010 Chris Lattner <sabre@nondot.org> reapply r121100 with a tweak to constant fold ConstExprs with TargetData
(if available) as we go so that we get simple constantexprs not insane ones.
This fixes the failure of clang/test/CodeGenCXX/virtual-base-ctor.cpp
that the previous iteration of this patch had.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121111 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6a3e3053263904fa296c86dc91778f54a8bb29c5 07-Dec-2010 Eric Christopher <echristo@apple.com> Temporarily revert r121100 as it's causing clang to fail
CodeGenCXX/virtual-base-ctor.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121102 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
fb431099c5783f5e25a0a4c789274256cde3e925 07-Dec-2010 Chris Lattner <sabre@nondot.org> fix PR8710 - teach global opt that some constantexprs are too complex to
put in a global variable's initializer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121100 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
f51a6cc5bf123d5d71bc846767b34701c4dc6014 06-Dec-2010 Chris Lattner <sabre@nondot.org> replace a linear scan with a symtab lookup, reduce indentation.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
99fca5de96d3435e8eb7c84e8366cee98ef5416a 19-Oct-2010 Mikhail Glushenkov <foldr@codedgers.com> GlobalOpt: EvaluateFunction() must not evaluate stores to weak_odr globals.

Fixes PR8389.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116812 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
9d28fdd7225b344789ed7f54cf51b4019763b30b 18-Oct-2010 Mikhail Glushenkov <foldr@codedgers.com> Trailing whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116749 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.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/IPO/GlobalOpt.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/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
ee56c42168f6c4271593f6018c4409b6a5910302 02-Aug-2010 Oscar Fuentes <ofv@wanadoo.es> Prefix `next' iterator operation with `llvm::'.

Fixes potential ambiguity problems on VS 2010.

Patch by nobled!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110029 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a399781289092fcdceb58b21174229f4373c4191 22-Jul-2010 Gabor Greif <ggreif@gmail.com> undo 80 column trespassing I caused

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109092 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
49669e6d3a5743bf02a7b22f16fee6fa187c1930 16-Jul-2010 Chris Lattner <sabre@nondot.org> eliminate unlockedRefineAbstractTypeTo, types are all per-llvmcontext,
so there is no locking involved in type refinement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108553 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
aaaaa02a93d3815d4cde97071ed354acc64ec6f6 12-Jul-2010 Gabor Greif <ggreif@gmail.com> cache result of operator*

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108144 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
5a30a8574cbcd3b385b1e8681c6a5c45856efb38 12-Jul-2010 Chris Lattner <sabre@nondot.org> make the prototypes for CreateMalloc and CreateFree more consistent. Patch
by Hans Vandierendonck from PR7605


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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107990 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
9e4f243de7c0a41ae02c93f7209ad97935e9853d 24-Jun-2010 Gabor Greif <ggreif@gmail.com> use ArgOperand API and CallSite for arg range; add necessary casts and perform some cosmetics

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106747 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a9b2313c13a1bc8cbae751da03a9049ecaf0f918 20-Apr-2010 Gabor Greif <ggreif@gmail.com> use abstract accessors to CallInst

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101899 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.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/IPO/GlobalOpt.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/IPO/GlobalOpt.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/IPO/GlobalOpt.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/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
86cd445645803282db7eccda297e0c19e9e25b51 14-Apr-2010 Evan Cheng <evan.cheng@apple.com> - Code clean up to reduce indentation.
- TryToOptimizeStoreOfMallocToGlobal should check if TargetData is available and bail out if it is not. The transformations being done requires TD.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101285 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a2fb234b04eb632fb23aff72e56fd3962aa56e65 10-Apr-2010 Chris Lattner <sabre@nondot.org> fix PR6760, a missing check in heap SRoA.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100936 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
272369149209bad11f2b2f9020362f77fae60579 07-Apr-2010 Gabor Greif <ggreif@gmail.com> fix 80-col violations

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100677 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6ce02b5939147784553c37d78e45a92dacee0037 06-Apr-2010 Gabor Greif <ggreif@gmail.com> make more two predicates constant

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100549 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a01d6db569c7def7c5d1727fa1abedfc160b688c 06-Apr-2010 Gabor Greif <ggreif@gmail.com> performance: get rid of repeated dereferencing of use_iterator by caching its result

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100547 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
0b520db74d75da91dbbc96ae7c939c49f1bc222d 06-Apr-2010 Gabor Greif <ggreif@gmail.com> const-ize predicate ValueIsOnlyUsedLocallyOrStoredToOneGlobal

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100546 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
fa1f5c22c5186d1055343aae74224a6637b831b2 06-Apr-2010 Gabor Greif <ggreif@gmail.com> use CallSite to access calls vs. invokes uniformly
and remove assumptions about operand order

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100544 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
f860db2398b39ed4602b595b9b352fd3f9556107 02-Apr-2010 Dan Gohman <gohman@apple.com> Revert the recent alignment changes. They're broken for -Os because,
in particular, they end up aligning strings at 16-byte boundaries, and
there's no way for GlobalOpt to check OptForSize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100172 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c9ae19e46520c1051b828171205b379b5a0bb6ad 02-Apr-2010 Dan Gohman <gohman@apple.com> Make globalopt refine global variable alignment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100160 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c8b82ccbcf3b2e2384d2c0b5176e7b0b40b7f82f 01-Apr-2010 Gabor Greif <ggreif@gmail.com> Introduce ImmutableCallSite, useful for contexts where no mutation
is necessary. Inherits from new templated baseclass CallSiteBase<>
which is highly customizable. Base CallSite on it too, in a configuration
that allows full mutation.
Adapt some call sites in analyses to employ ImmutableCallSite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100100 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
654c06f6457f80428e40810ad251c412462731e4 20-Mar-2010 Gabor Greif <ggreif@gmail.com> Add a setCalledFunction member to InvokeInst (like in CallInst)
and use this (as well as getCalledValue) to access the callee,
instead of {g|s}etOperand(0).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99084 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
e9fd444dcd59f5b17bd30f919cb1b3a50519d3c1 27-Feb-2010 Chris Lattner <sabre@nondot.org> Fix rdar://7694996 a miscompile of 183.equake from my patch yesterday,
confusing the old MAT variable with the new GlobalType one. This caused
us to promote the @disp global pointer into:

@disp.body = internal global double*** undef

instead of:

@disp.body = internal global [3 x double**] undef




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97285 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c6a669b6e7fb13669abefa62c6ac4f871b84bb0b 27-Feb-2010 Chris Lattner <sabre@nondot.org> remove dead code, by this point all uses of CI are gone.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97283 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
3f5e0b8114e8f446b42d5102805494801af38ecb 26-Feb-2010 Chris Lattner <sabre@nondot.org> fix PR6435 another bug from the MallocInst elimination work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97231 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a687465bae9ce793444fef37eb790ac7722f6bc7 25-Feb-2010 Chris Lattner <sabre@nondot.org> rewrite OptimizeGlobalAddressOfMalloc to fix PR6422, some bugs
introduced when mallocinst was eliminated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97178 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
e7ee59b6a4ec6c7a360a77aac044a546b0012c37 25-Feb-2010 Nick Lewycky <nicholas@mxc.ca> Modernize comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97121 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
b0bc6c361da9009e8414efde317d9bbff755f6c0 15-Feb-2010 Duncan Sands <baldrick@free.fr> Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96223 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b489d0f88a59cf620fad7a0a82037ad2cd3cad16 30-Jan-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Keep iterating over all uses when meeting a phi node in AllUsesOfValueWillTrapIfNull().

This bug was exposed by my inliner cost changes in r94615, and caused failures
of lencod on most architectures when building with LTO.

This patch fixes lencod and 464.h264ref on x86-64 (and likely others).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94858 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
4039bd055086ec741132afe32f1ab7fdf5ebd710 07-Jan-2010 Chris Lattner <sabre@nondot.org> handle ConstantVector while I'm in here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a0e9a2475cd6e45966a591de8e0740a102fe0dfe 07-Jan-2010 Chris Lattner <sabre@nondot.org> fix a globalopt crash on 'bullet' (handling evaluation of a store
to an element of a vector in a static ctor) which occurs with an
unrelated patch I'm testing. Annoyingly, EvaluateStoreInto basically
does exactly the same stuff as InsertElement constant folding, but it
now handles vectors, and you can't insertelement into a vector. It
would be 'really nice' if GEP into a vector were not legal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92889 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8c65f6e71c1d46d823b9a884819992a9255edd54 05-Jan-2010 Benjamin Kramer <benny.kra@googlemail.com> Move remaining stuff to the isInteger predicate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92771 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
f012705c7e4ca8cf90b6b734ce1d5355daca5ba5 05-Jan-2010 Benjamin Kramer <benny.kra@googlemail.com> Avoid going through the LLVMContext for type equality where it's safe to dereference the type pointer.


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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92629 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7a154cf22830857bc184566102abd8a2ada8df94 08-Dec-2009 Duncan Sands <baldrick@free.fr> Teach GlobalOpt to delete aliases with internal linkage (after
forwarding any uses). GlobalDCE can also do this, but is only
run at -O3.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90850 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
01b97dd01eec1197d79fceb7229f5ec233994de3 23-Nov-2009 Dan Gohman <gohman@apple.com> Make ConstantFoldConstantExpression recursively visit the entire
ConstantExpr, not just the top-level operator. This allows it to
fold many more constants.

Also, make GlobalOpt call ConstantFoldConstantExpression on
GlobalVariable initializers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89659 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8e345a1c418608c49abb7c51a090bbb36f1273bc 10-Nov-2009 Victor Hernandez <vhernandez@apple.com> Update computeArraySize() to use ComputeMultiple() to determine the array size associated with a malloc; also extend PerformHeapAllocSRoA() to check if the optimized malloc's arg had its highest bit set, so that it is safe for ComputeMultiple() to look through sext instructions while determining the optimized malloc's array size

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86676 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
631f3c0dfdf21b0702fcd9baa4ce79ec9ab360dc 07-Nov-2009 Victor Hernandez <vhernandez@apple.com> - new SROA mallocs should have the mallocs running-or'ed, not the malloc's bitcast
- fix ProcessInternalGlobal() debug output



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86317 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
9d0b704e3ea418441001dac4d1a56c2c224cdbf5 07-Nov-2009 Victor Hernandez <vhernandez@apple.com> Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.

Here is the original commit message:

This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments.

Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses. The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses. The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86311 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7b550ccfc5a3346c17e0390a59e2d6d19bc52705 06-Nov-2009 Chris Lattner <sabre@nondot.org> remove a bunch of extraneous LLVMContext arguments
from various APIs, addressing PR5325.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86231 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
df98761d08ae091420b7e9c1366de7684400fc36 06-Nov-2009 Victor Hernandez <vhernandez@apple.com> Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86213 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
24f934d0551e33508c4ffd24318ea0e970db9810 05-Nov-2009 Victor Hernandez <vhernandez@apple.com> Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses. The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses. The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86077 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
ec4c7b976645cc49ccfe8dc1c3bfc31ec5fedc62 01-Nov-2009 Chris Lattner <sabre@nondot.org> cleanups, switch GlobalDCE to SmallPtrSet instead of std::set


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85730 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
cdfc940912d56a63b6f12eaa7f3faf79cf74c693 01-Nov-2009 Chris Lattner <sabre@nondot.org> Revert 85678/85680. The decision is to stay with the current form of
indirectbr, thus we don't need "blockaddr(@func, null)". Eliminate it
for simplicity.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85699 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c1dc35094e3ffcb4b3a765f0f786b8a2948bc321 31-Oct-2009 Chris Lattner <sabre@nondot.org> adjust a couple xforms to work with null bb's in BlockAddress.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b3d5a65d94ca017570fe86578423186c6a2f642e 29-Oct-2009 Chris Lattner <sabre@nondot.org> just for the hell of it, allow globalopt to statically evaluate
static constructors with indirect gotos :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85495 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
90f48e7c91a8faa875ba889ca66b137ffd46e34a 28-Oct-2009 Victor Hernandez <vhernandez@apple.com> Extend getMallocArraySize() to determine the array size if the malloc argument is:
ArraySize * ElementSize
ElementSize * ArraySize
ArraySize << log2(ElementSize)
ElementSize << log2(ArraySize)

Refactor isArrayMallocHelper and delete isSafeToGetMallocArraySize, so that there is only 1 copy of the malloc array determining logic.
Update users of getMallocArraySize() to not bother calling isArrayMalloc() as well.



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


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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
66284e063a1e46500acae48bdc0e4a00652021d1 24-Oct-2009 Victor Hernandez <vhernandez@apple.com> Auto-upgrade free instructions to calls to the builtin free function.
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84987 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a276c603b82a11b0bf0b59f0517a69e4b63adeab 17-Oct-2009 Victor Hernandez <vhernandez@apple.com> Remove MallocInst from LLVM Instructions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8db42d2b1ce05e69b67f37c4e56a0f987a0c01d7 17-Oct-2009 Victor Hernandez <vhernandez@apple.com> HeapAllocSRoA also needs to check if malloc array size can be computed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84288 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
2491ce03535cf8ec171570d2e28df63e4db3dd6b 15-Oct-2009 Victor Hernandez <vhernandez@apple.com> Fix bug where array malloc with unexpected computation of the size argument resulted in MallocHelper
identifying the malloc as a non-array malloc. This broke GlobalOpt's optimization of stores of mallocs
to global variables.

The fix is to classify malloc's into 3 categories:
1. non-array mallocs
2. array mallocs whose array size can be determined
3. mallocs that cannot be determined to be of type 1 or 2 and cannot be optimized

getMallocArraySize() returns NULL for category 3, and all users of this function must avoid their
malloc optimization if this function returns NULL.

Eventually, currently unexpected codegen for computing the malloc's size argument will be supported in
isArrayMalloc() and getMallocArraySize(), extending malloc optimizations to those examples.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84199 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c6f69e94fa46f585b59bb9d7ace3224b0e638c95 05-Oct-2009 Dan Gohman <gohman@apple.com> Remove an unnnecessary LLVMContext argument in
ConstantFoldLoadThroughGEPConstantExpr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83311 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c332fba8285e35a5a11463c34795af84f3960759 19-Sep-2009 Nick Lewycky <nicholas@mxc.ca> Remove the default value for ConstantStruct::get's isPacked parameter and
update the code which was broken by this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82327 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
e6992f728a94654e43269580a10a667f18dadba9 11-Sep-2009 Dan Gohman <gohman@apple.com> Factor out the code for checking that all indices in a getelementptr are
within the notional bounds of the static type of the getelementptr (which
is not the same as "inbounds") from GlobalOpt into a utility routine,
and use it in ConstantFold.cpp to check whether there are any mis-behaved
indices.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
80bdc967e946b5d68646ffdee857400f9a120cca 08-Sep-2009 Dan Gohman <gohman@apple.com> Don't commit stores with addresses that have indices that are not
compile-time constant integers or that are out of bounds for their
corresponding static array types. These can cause aliasing that
GlobalOpt assumes won't happen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81165 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
ce5de5b52768d0c3b9c0f6c4bc915a17e962202c 08-Sep-2009 Dan Gohman <gohman@apple.com> Don't commit addresses of aggregate values. This avoids problems with
an aggregate store overlapping a different aggregate store, despite
the stores having distinct addresses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81164 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c62482d4edecd416e6529e31427fa6fd8a9b7ece 08-Sep-2009 Dan Gohman <gohman@apple.com> Fix GlobalOpt to avoid committing a store if the address getelementptr
is missing the inbounds flag. This is slightly conservative, but it
avoids problems with two constants pointing to the same address but
getting distinct entries in the Memory DenseMap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81163 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
4a7e6b7a15cea1f8ead4d1bb1cf2e3a39a339cb3 08-Sep-2009 Dan Gohman <gohman@apple.com> Preserve the InBounds flag when evaluating a getelementptr instruction
into a getelementptr ConstantExpr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81162 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
fd54a898be08e8da12cb2e99dbb63015083940a3 08-Sep-2009 Dan Gohman <gohman@apple.com> Simplify this code by using hasDefinitiveInitializer().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81161 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
bdff548e4dd577a72094d57b282de4e765643b96 23-Aug-2009 Chris Lattner <sabre@nondot.org> eliminate the "Value" printing methods that print to a std::ostream.
This required converting a bunch of stuff off DOUT and other cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79819 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8255573835970e7130ba93271972172fb335f2ec 19-Aug-2009 Dan Gohman <gohman@apple.com> Use hasDefinitiveInitializer() instead of testing the same thing
by hand, and fix a few places that were using hasInitializer() that
appear to depend on the initializer value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79441 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6874a2ae033b7b5e1d0c10714e01d9c87480956a 18-Aug-2009 Dan Gohman <gohman@apple.com> Fix a bug that caused globalopt to miscompile tramp3d: don't miss
unruly indices for arrays that are members of structs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79337 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
fa6a1cf1ed4282145269b12578f687b3869d6476 17-Aug-2009 Duncan Sands <baldrick@free.fr> Don't access the first element of a potentially empty
vector (&Formals[0]). With this change llvm-gcc builds
with expensive checking enabled for C, C++ and Fortran.
While there, change a std::vector into a SmallVector.
This is partly gratuitous, but mostly because not all
STL vector implementations define the data method (and
it should be faster).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7eb28f3786543f63cb9a4099655e6d456fca71f7 14-Aug-2009 Dan Gohman <gohman@apple.com> Make TargetData optional in GlobalOpt and ArgumentPromotion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78967 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
4ae5126d041768ab9665cf2f11c024becd76c41f 12-Aug-2009 Dan Gohman <gohman@apple.com> Remove a bunch more now-unnecessary Context arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78809 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
d7f2a6cb3fbc012763adb42fd967f6fefbb22a37 06-Aug-2009 Owen Anderson <resistor@mac.com> Privatize the StructType table, which unfortunately involves routing contexts through a number of APIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78258 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a7235ea7245028a0723e8ab7fd011386b3900777 31-Jul-2009 Owen Anderson <resistor@mac.com> Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
fe09b2098ac483f6d6ce6ea4ab237a9539bdb6b9 30-Jul-2009 Daniel Dunbar <daniel@zuster.org> Twines: Don't allow implicit conversion from integers, this is too tricky.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7f93dc8345fb33652973e35cae4c3b58addf4f87 30-Jul-2009 Daniel Dunbar <daniel@zuster.org> Switch obvious clients to Twine instead of utostr (when they were already using
a Twine, e.g., for names).
- I am a little ambivalent about this; we don't want the string conversion of
utostr, but using overload '+' mixed with string and integer arguments is
sketchy. On the other hand, this particular usage is something of an idiom.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77579 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
debcb01b0f0a15f568ca69e8f288fade4bfc7297 30-Jul-2009 Owen Anderson <resistor@mac.com> Move types back to the 2.5 API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77516 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
baf3c404409d5e47b13984a7f95bfbd6d1f2e79e 29-Jul-2009 Owen Anderson <resistor@mac.com> Move ConstantExpr to 2.5 API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
1fd7096407d5e598ed3366a1141548e71273f1c5 28-Jul-2009 Owen Anderson <resistor@mac.com> Change ConstantArray to 2.5 API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77347 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8fa3338ed2400c1352b137613d2c2c70d1ead695 28-Jul-2009 Owen Anderson <resistor@mac.com> Move ConstantStruct back to 2.5 API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77266 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
eed707b1e6097aac2bb6b3d47271f6300ace7f2e 25-Jul-2009 Owen Anderson <resistor@mac.com> Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77011 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
001dbfebcbbded8c8e74b19e838b50da2b6c6fb5 16-Jul-2009 Owen Anderson <resistor@mac.com> Move the ConstantInt uniquing table into LLVMContextImpl. This exposed a number of issues in
our current context-passing stuff, which is also fixed here


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76089 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
50dead06ffc107edb7e84857baaeeb09039c631c 16-Jul-2009 Owen Anderson <resistor@mac.com> Revert yesterday's change by removing the LLVMContext parameter to AllocaInst and MallocInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75863 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
9adc0abad3c3ed40a268ccbcee0c74cb9e1359fe 15-Jul-2009 Owen Anderson <resistor@mac.com> Move EVER MORE stuff over to LLVMContext.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75703 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
73c6b7127aff4499e4d6a2edb219685aee178ee1 13-Jul-2009 Owen Anderson <resistor@mac.com> Move more functionality over to LLVMContext.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75497 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
e9b11b431308f4766b73cda93e38ec930c912122 08-Jul-2009 Owen Anderson <resistor@mac.com> Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75025 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
3d29df3e8a203b167d8071ea6f805b21db18a5af 08-Jul-2009 Owen Anderson <resistor@mac.com> Push LLVMContext through GlobalVariables and IRBuilder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
07cf79ef537caff6d39145f190a28a336e629b6f 07-Jul-2009 Owen Anderson <resistor@mac.com> "LLVMContext* " --> "LLVMContext *"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74878 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
508955156a25a9abc470a29e1760aa176d341cf9 06-Jul-2009 Owen Anderson <resistor@mac.com> Thread LLVMContext through the constant folding APIs, which touches a lot of files.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74844 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
14ce9ef2e9013ba56e1daafebd91fe3ee1e8647e 06-Jul-2009 Owen Anderson <resistor@mac.com> More LLVMContext-ification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74811 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
0fd38069cb6699ce21eb159f22d3f23c012c9e81 01-Jul-2009 Chris Lattner <sabre@nondot.org> improve the APIs for creating struct and function types with no arguments/elements
to not have to create a temporary vector (in the API at least). Patch by Jay Foad!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74584 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
059aa8c604ddbc5fd88a981f2218713aea4f49a9 17-Jun-2009 Sanjiv Gupta <sanjiv.gupta@microchip.com> >> What if my global variable was into a different address space than stack?
>>
>
> It doesn't matter in terms of semantics: because AnalyzeGlobal
> returned false, we're guaranteed the address of the global is never
> taken. I wouldn't be surprised if we end up generating invalid IR in
> some cases, though, because of the semantics of replaceAllUsesWith.
> Do you have a testcase that breaks?
>
>
The problem is replaceAllUsesWith asserts for type mismatch here. Try attached .bc with llvm-ld.

assert(New->getType() == getType() &&
"replaceAllUses of value with new value of different type!");

Since stack is always on address space zero, I don't think that type of GV in a different address space is ever going to match.
The other way is to allow replaceAllUsesWith to ignore address spaces while comparing types. (do we have a way to do that ?).
But then such an optimization may fail the entire idea of user wanting to place a variable into different memory space. The original idea of user might be to save on the stack space (data memory) and hence he asked the variable to be placed into different memory space (program memory). So the best bet here is to deny this optimization by checking

GV->getType()->getAddressSpace() == 0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
757068f3bad425fb126fe16ab7b8a82a636e6bbd 10-Jun-2009 Jay Foad <jay.foad@gmail.com> Implement and use new method Function::hasAddressTaken().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73164 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
e3acf159d968b5a9db350203d8160a4d3c2d1a43 09-Jun-2009 Jay Foad <jay.foad@gmail.com> Remove an unused function SafeToDestroyConstant(). Rename an almost
identical function ConstantIsDead() to SafeToDestroyConstant(), to
emphasise the connection with Constant::destroyConstant().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73149 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
0906b1bf09769d5301e62d372b363b4cd0b5a6c7 06-Jun-2009 Jay Foad <jay.foad@gmail.com> Use cast<> instead of dyn_cast<> for things that are known to be
Instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73002 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
5d16396a33bfaa76da99c97c526a737af9618d05 02-Jun-2009 Evan Cheng <evan.cheng@apple.com> Avoid infinite looping in AllGlobalLoadUsesSimpleEnoughForHeapSRA(). This can happen when PHI uses are recursively dependent on each other.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72710 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
777d2306b36816a53bc1ae1244c0dc7d998ae691 09-May-2009 Duncan Sands <baldrick@free.fr> Rename PaddedSize to AllocSize, in the hope that this
will make it more obvious what it represents, and stop
it being confused with the StoreSize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71349 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
0e670dfa277279463d7c8d8bba093c2b2160d9ff 03-May-2009 Nick Lewycky <nicholas@mxc.ca> Revert r70630. Go back to appending ".b" to internal globals when shrinking
them to bool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70653 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
0e80b7cda155ef89dbac46d5d226bb333021b5f7 02-May-2009 Nick Lewycky <nicholas@mxc.ca> Don't append ".b" to the names of globals that are being shrunk to booleans.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70630 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
412a4469746d468c46b7e7e4f1c77407dab0a1ce 10-Mar-2009 Devang Patel <dpatel@apple.com> Ignore debug info while evaluating function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66490 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8e10844ad0341fa4b0a1264324a3614903d8ff9e 08-Mar-2009 Chris Lattner <sabre@nondot.org> use MemTransferInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66362 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6f6923fd4fdab46c88503c71548e076dd7373b74 08-Mar-2009 Chris Lattner <sabre@nondot.org> fix a serious pessimization that Tron on IRC pointed out where we would
"boolify" pointers, generating really awful code because getting the pointer
value requires a load itself. Before:

_foo:
movb $1, _X.b
ret
_get:
xorl %ecx, %ecx
movb _X.b, %al
testb %al, %al
movl $_Y, %eax
cmove %ecx, %eax
ret

With the xform disabled:

_foo:
movl $_Y, _X
ret
_get:
movl _X, %eax
ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
fc5940d2a09a795e683ae86b237d6f55fb3551d4 06-Mar-2009 Duncan Sands <baldrick@free.fr> While thinking about the one-definition-rule and trying
to find a tiny mouse hole to squeeze through, it struck
me that globals without a name can be considered internal
since they can't be referenced from outside the current
module. This patch makes GlobalOpt give them internal
linkage. Also done for aliases even though they always
have names, since in my opinion anonymous aliases should
be allowed for consistency with global variables and
functions. So if that happens one day, this code is ready!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66267 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
771281f1806ba3299fb515f59bd2f726a6a7a77e 06-Mar-2009 Devang Patel <dpatel@apple.com> Revert 66224.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66233 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
743cdf8edf21d96b3d155eb322578936aebc4876 06-Mar-2009 Devang Patel <dpatel@apple.com> Revert rev. 66167.
We are still not out of woods yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66232 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
f70bda2f8175db0e0ea24d080a8e5c921b95a74c 06-Mar-2009 Devang Patel <dpatel@apple.com> Do not let debug info prevert globalopt from shriking a global vars to boolean.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66224 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
504960067233f271884c23869e81272918ad2883 05-Mar-2009 Devang Patel <dpatel@apple.com> GlobalOpt only process non constant local GVs while optimizing global vars.

If non constant local GV named A is used by a constant local GV named B (e.g. llvm.dbg.variable) and B is not used by anyone else then eliminate A as well as B.

In other words, debug info should not interfere in removal of unused GV.
--This life, and those below, will be ignored--

M test/Transforms/GlobalOpt/2009-03-03-dbg.ll
M lib/Transforms/IPO/GlobalOpt.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66167 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
380c3ca0937e2a9ea9e5457f3e2d06e776d05341 04-Mar-2009 Bill Wendling <isanbard@gmail.com> Temporarily revert r65994. It was causing rdar://6646455.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66083 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7f6179d1d8723fdbd59ff105cecc4632d897e99d 04-Mar-2009 Devang Patel <dpatel@apple.com> If a global constant is dead then global's debug info should not prevent the optimizer in deleting the global. And while deleting global, delete global's debug info also.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
95c5d0fb0a4e1ec88edae43c2db464e0cc63c76e 18-Feb-2009 Duncan Sands <baldrick@free.fr> In theory the aliasee may have dead constant users
here. Since we only do the transform if there is
one use, strip off any such users in the hope of
making the transform fire more often.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64926 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7ae5b9e1eb1bf70ffecc34c42d66743d5f029d3a 17-Feb-2009 Duncan Sands <baldrick@free.fr> This transform also applies to private linkage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64773 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a37d119f63c6aa1a6b93d4aa6ea0019b7bf5ee16 15-Feb-2009 Duncan Sands <baldrick@free.fr> Make this more useful for cleaning up after the
one-definition-rule llvm-gcc changes (coming soon
to a tree near you!).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64588 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
4782b305c2ccc2b2e5a4cad65d7ffd15395d0727 15-Feb-2009 Duncan Sands <baldrick@free.fr> If the target of an alias has internal linkage, then the
alias can be morphed into the target. Implement this
transform, and fix a crash in the existing transform at
the same time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64583 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a36791da41cf4f635e50077b290676b873836bda 23-Jan-2009 Gabor Greif <ggreif@gmail.com> Simplify the logic of getting hold of a PHI predecessor block.
There is now a direct way from value-use-iterator to incoming block in PHINode's API.
This way we avoid the iterator->index->iterator trip, and especially the costly
getOperandNo() invocation. Additionally there is now an assertion that the iterator
really refers to one of the PHI's Uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
bb46f52027416598a662dc1c58f48d9d56b1a65b 15-Jan-2009 Rafael Espindola <rafael.espindola@gmail.com> Add the private linkage.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
92c6bd2c45f0002385300a8aa298fa34ef9bff64 14-Jan-2009 Chris Lattner <sabre@nondot.org> rewrite OptimizeAwayTrappingUsesOfLoads to 1) avoid a temporary
vector and extraneous loop over it, 2) not delete globals used by
phis/selects etc which could actually be useful. This fixes PR3321.
Many thanks to Duncan for narrowing this down.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62201 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b5024401648eb58e2a9150ce0f57a56ad87daeaf 13-Jan-2009 Duncan Sands <baldrick@free.fr> Correct a comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62165 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
ceb4d1aecb9deffe59b3dcdc9a783ffde8477be9 12-Jan-2009 Duncan Sands <baldrick@free.fr> Rename getABITypeSize to getTypePaddedSize, as
suggested by Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
177d84e048d3c0b94ff2d2ff1a9bda8d498c1397 07-Jan-2009 Duncan Sands <baldrick@free.fr> Whitespace - correct formatting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61879 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
f49a28cd0287351bce7a17dfffdbce4926763b5b 17-Dec-2008 Chris Lattner <sabre@nondot.org> insert some sequence points and preincrement an iterator to avoid
iterator invalidation problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61124 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
bce4afe83968bf6504aaf0791d4c49f971d58c52 17-Dec-2008 Chris Lattner <sabre@nondot.org> Enhance heap sra to be substantially more aggressive w.r.t PHI
nodes. This allows it to do fairly general phi insertion if a
load from a pointer global wants to be SRAd but the load is used
by (recursive) phi nodes. This fixes a pessimization on ppc
introduced by Load PRE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61123 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
85d3d4f35de33c6d0d3800bd87619c00d06a98e2 16-Dec-2008 Chris Lattner <sabre@nondot.org> Fix another crash found by inspection. If we have a PHI node merging
the load multiple times, make sure the check the uses of the PHI to
ensure they are transformable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61102 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
542dc1a0decc2b598a1f856370a55091a51e102c 16-Dec-2008 Chris Lattner <sabre@nondot.org> fix a crash found by inspection.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61101 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
5a6bb6ae78fb42bedd8987ccd611abd0a548edbf 16-Dec-2008 Chris Lattner <sabre@nondot.org> switch some std::set/std::map to SmallPtrSet/DenseMap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61081 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
101f44e81f3bfae1b8ebefe74bef73883dac78ac 15-Dec-2008 Chris Lattner <sabre@nondot.org> enhance heap-sra to apply to fixed sized array allocations, not just
variable sized array allocations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61051 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
344b41cfbd30980a2194c56db382b0537d087ea9 15-Dec-2008 Chris Lattner <sabre@nondot.org> Use stripPointerCasts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61047 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
49b6d4ae9e3132525657880c45619f83e5c89c8f 15-Dec-2008 Chris Lattner <sabre@nondot.org> minor tweaks for formatting, allow bitcast in ValueIsOnlyUsedLocallyOrStoredToOneGlobal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61046 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
e61d0a626e58bdba004a7aad9abecb3a9bd85256 15-Dec-2008 Chris Lattner <sabre@nondot.org> refactor some code into a new TryToOptimizeStoreOfMallocToGlobal function.
Use GetElementPtrInst::hasAllZeroIndices where possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
0598866c052147c31b808391f58434ce3dbfb838 25-Sep-2008 Devang Patel <dpatel@apple.com> Large mechanical patch.

s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g

This sets the stage
- to implement function notes as function attributes and
- to distinguish between function attributes and return value attributes.

This requires corresponding changes in llvm-gcc and clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56622 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
19e861a4ffb896f16a691d5ac869e894df3cd464 09-Sep-2008 Anton Korobeynikov <asl@math.spbu.ru> Make safer variant of alias resolution routine to be default

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56005 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
e4c6b61ebd8f2dbb6a2e51fe1d0e2bdbe17986c4 09-Sep-2008 Anton Korobeynikov <asl@math.spbu.ru> Resolve aliases, when possible

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56001 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
f9e67aca52b3d889f4a5c38aaaa336020bba8ae4 13-Aug-2008 Bill Wendling <isanbard@gmail.com> Remove tabs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54707 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
bc1f989e3c58b24faf37a149a1ede294483b09b8 17-Jul-2008 Matthijs Kooijman <matthijs@stdin.nl> Make GlobalOpt preserve address spaces when scalar replacing aggregate globals.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53716 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
5e46321d665d6b1f445aff70d8eabb4870a6cf0e 29-May-2008 Gabor Greif <ggreif@gmail.com> convert more operand loops to iterator formulation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51663 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
399101a5990621b0357009ab1852cc00f410a6c6 23-May-2008 Dan Gohman <gohman@apple.com> Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7cbd8a3e92221437048b484d5ef9c0a22d0f8c58 16-May-2008 Gabor Greif <ggreif@gmail.com> API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. Legacy interfaces will be in place for some time. (Merge from use-diet branch.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51200 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b1dbcd886a4b5597a839f299054b78b33fb2d6df 15-May-2008 Gabor Greif <ggreif@gmail.com> Fix a bunch of 80col violations that arose from the Create API change. Tweak makefile targets to find these better.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
998182b3802d2be8d081ca484b5d4fd5e1188950 26-Apr-2008 Chris Lattner <sabre@nondot.org> When SRoA'ing a global variable, make sure the new globals get the
appropriate alignment. This fixes a miscompilation of 252.eon on
x86-64 (rdar://5891920).

Bill, please pull this into Tak.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50308 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
c9235d2e855c56e9aa157969f8132a05f9ba89d8 22-Mar-2008 Dan Gohman <gohman@apple.com> Don't include <map> in Pass.h, which doesn't need it. This requires
adding <map> to many files that actually do need it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
58d74910c6b82e622ecbb57d6644d48fec5a5c0f 12-Mar-2008 Chris Lattner <sabre@nondot.org> Reimplement the parameter attributes support, phase #1. hilights:

1. There is now a "PAListPtr" class, which is a smart pointer around
the underlying uniqued parameter attribute list object, and manages
its refcount. It is now impossible to mess up the refcount.
2. PAListPtr is now the main interface to the underlying object, and
the underlying object is now completely opaque.
3. Implementation details like SmallVector and FoldingSet are now no
longer part of the interface.
4. You can create a PAListPtr with an arbitrary sequence of
ParamAttrsWithIndex's, no need to make a SmallVector of a specific
size (you can just use an array or scalar or vector if you wish).
5. All the client code that had to check for a null pointer before
dereferencing the pointer is simplified to just access the
PAListPtr directly.
6. The interfaces for adding attrs to a list and removing them is a
bit simpler.

Phase #2 will rename some stuff (e.g. PAListPtr) and do other less
invasive changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
22c3979fcaa7ff19c44253eb9b0b0160dfef0aa4 22-Feb-2008 Dale Johannesen <dalej@apple.com> Split ParameterAttributes.h, putting the complicated
stuff into ParamAttrsList.h. Per feedback from
ParamAttrs changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47504 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
548448a317b39ec8446f3c82f44d01f938b921b2 18-Feb-2008 Duncan Sands <baldrick@free.fr> Simplify caller updating using a CallSite, as
requested by Chris. While there, do the same
for an existing function committed by someone
called "lattner" :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47273 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
3d5378ff8e015e6ede4fd3d33c3e05a1dfec5b99 16-Feb-2008 Duncan Sands <baldrick@free.fr> Remove any 'nest' parameter attributes if the function
is not passed as an argument to a trampoline intrinsic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47220 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c69d3c94425cbdcbfe4f758e07ba083d3377a382 29-Jan-2008 Chris Lattner <sabre@nondot.org> Don't let globalopt hack on volatile loads or stores.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46523 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
941db495b8233a3753ce72a84021f677073ff4ea 14-Jan-2008 Chris Lattner <sabre@nondot.org> Fix the miscompilation of MiBench/consumer-lame that was exposed by Evan's
byval work. This miscompilation is due to the program indexing an array out
of range and us doing a transformation that broke this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6a93fc01a787ae53095504f882781dbf550b23c6 14-Jan-2008 Chris Lattner <sabre@nondot.org> The isNotSuitableForSRA property is now dead, don't compute it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45948 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
727c21084d2f96c25b0ec1bc9a03cb88105a417c 14-Jan-2008 Chris Lattner <sabre@nondot.org> Change SRAGlobal to not depend on isNotSuitableForSRA, which makes it very
difficult to understand the invariants.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45947 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
58e44f49ddd16825fbacc60d6146376ca17f47eb 14-Jan-2008 Chris Lattner <sabre@nondot.org> Make the 'shrink global to bool' optimization more self contained, and thus
easier to show that its safe. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45946 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
9027b3cc7f79a67ecf75640c0e25a73dc61d62cf 04-Jan-2008 Chris Lattner <sabre@nondot.org> Fix PR1896


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45568 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.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/IPO/GlobalOpt.cpp
43ad6b3e0d6ada51e9b23aab3e061187f1f5710c 17-Dec-2007 Christopher Lamb <christopher.lamb@gmail.com> Change the PointerType api for creating pointer types. The old functionality of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45082 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
19450241e5ca3f679251c29f4926bb5f12ed535f 13-Nov-2007 Chris Lattner <sabre@nondot.org> Fix the regression on Transforms/GlobalOpt/deadglobal-2.ll from my
patch on friday.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44068 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7b52fe7272ec337a77b7cc96b14e27d15fec3c89 09-Nov-2007 Chris Lattner <sabre@nondot.org> Tighten up a check for folding away loads from (newly constant) globals. This
fixes a crash on Transforms/GlobalOpt/2007-11-09-GEP-GEP-Crash.ll and
rdar://5585488.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
514ab348fddcdffa8367685dc608b2f8d5de986d 01-Nov-2007 Duncan Sands <baldrick@free.fr> Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.
The meaning of getTypeSize was not clear - clarifying it is important
now that we have x86 long double and arbitrary precision integers.
The issue with long double is that it requires 80 bits, and this is
not a multiple of its alignment. This gives a primitive type for
which getTypeSize differed from getABITypeSize. For arbitrary precision
integers it is even worse: there is the minimum number of bits needed to
hold the type (eg: 36 for an i36), the maximum number of bits that will
be overwriten when storing the type (40 bits for i36) and the ABI size
(i.e. the storage size rounded up to a multiple of the alignment; 64 bits
for i36).

This patch removes getTypeSize (not really - it is still there but
deprecated to allow for a gradual transition). Instead there is:

(1) getTypeSizeInBits - a number of bits that suffices to hold all
values of the type. For a primitive type, this is the minimum number
of bits. For an i36 this is 36 bits. For x86 long double it is 80.
This corresponds to gcc's TYPE_PRECISION.

(2) getTypeStoreSizeInBits - the maximum number of bits that is
written when storing the type (or read when reading it). For an
i36 this is 40 bits, for an x86 long double it is 80 bits. This
is the size alias analysis is interested in (getTypeStoreSize
returns the number of bytes). There doesn't seem to be anything
corresponding to this in gcc.

(3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded
up to a multiple of the alignment. For an i36 this is 64, for an
x86 long double this is 96 or 128 depending on the OS. This is the
spacing between consecutive elements when you form an array out of
this type (getABITypeSize returns the number of bytes). This is
TYPE_SIZE in gcc.

Since successive elements in a SequentialType (arrays, pointers
and vectors) need to be aligned, the spacing between them will be
given by getABITypeSize. This means that the size of an array
is the length times the getABITypeSize. It also means that GEP
computations need to use getABITypeSize when computing offsets.
Furthermore, if an alloca allocates several elements at once then
these too need to be aligned, so the size of the alloca has to be
the number of elements multiplied by getABITypeSize. Logically
speaking this doesn't have to be the case when allocating just
one element, but it is simpler to also use getABITypeSize in this
case. So alloca's and mallocs should use getABITypeSize. Finally,
since gcc's only notion of size is that given by getABITypeSize, if
you want to output assembler etc the same as gcc then getABITypeSize
is the size you want.

Since a store will overwrite no more than getTypeStoreSize bytes,
and a read will read no more than that many bytes, this is the
notion of size appropriate for alias analysis calculations.

In this patch I have corrected all type size uses except some of
those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard
cases). I will get around to auditing these too at some point,
but I could do with some help.

Finally, I made one change which I think wise but others might
consider pointless and suboptimal: in an unpacked struct the
amount of space allocated for a field is now given by the ABI
size rather than getTypeStoreSize. I did this because every
other place that reserves memory for a type (eg: alloca) now
uses getABITypeSize, and I didn't want to make an exception
for unpacked structs, i.e. I did it to make things more uniform.
This only effects structs containing long doubles and arbitrary
precision integers. If someone wants to pack these types more
tightly they can always use a packed struct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43620 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
5e6e494a977614568ed5582dacb548f8d466d398 14-Sep-2007 Chris Lattner <sabre@nondot.org> Fix a logic error in ValueIsOnlyUsedLocallyOrStoredToOneGlobal that caused
miscompilation of 188.ammp. Reject select and bitcast in
ValueIsOnlyUsedLocallyOrStoredToOneGlobal because RewriteHeapSROALoadUser can't handle it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41950 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
309f20fc45a599ca45ad1262525d9f4c332b1911 13-Sep-2007 Chris Lattner <sabre@nondot.org> Teach GlobalLoadUsesSimpleEnoughForHeapSRA and the SROA rewriter how to handle
a limited form of PHI nodes. This finally fixes PR1639, speeding 179.art up
from 7.84s to 3.13s on PPC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41933 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a637a8b1e7ecc9ce06e0463b64be0721bf52255d 13-Sep-2007 Chris Lattner <sabre@nondot.org> be tolerant of PHI nodes when rewriting heap SROA code. This is a step
along the way of PR1639


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41930 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
330245e90bc3c74cebfbae47d67aaef8d74a73dd 13-Sep-2007 Chris Lattner <sabre@nondot.org> refactor some code, no functionality change. On the path to PR1639



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41929 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c451f9c1670321256c22fc1a44a7cc62f7ad523b 13-Sep-2007 Chris Lattner <sabre@nondot.org> Make ValueIsOnlyUsedLocallyOrStoredToOneGlobal smart enough to see through
bitcasts and phis. This is a step to fixing PR1639.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41928 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
816861803fe4f5e17f565f00e70989ab24d7ec45 13-Sep-2007 Chris Lattner <sabre@nondot.org> Make AllUsesOfLoadedValueWillTrapIfNull strong enough to see through PHI
nodes. This is the first step of the fix for PR1639.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41927 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b8f74793b9d161bc666fe27fc92fe112b6ec169b 04-Sep-2007 David Greene <greened@obbligato.org> Update GEP constructors to use an iterator interface to fix
GLIBCXX_DEBUG issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
f0a9aaba4c61388678494c17c690f93b7eff270c 05-Jun-2007 Chris Lattner <sabre@nondot.org> When rebuilding constant structs, make sure to honor the isPacked bit.
This fixes PR1491 and GlobalOpt/2007-06-04-PackedStruct.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37423 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
ce3e2bff8bd22ef63d10923c9d0fbab922e00957 15-May-2007 Chris Lattner <sabre@nondot.org> selects can also reach here


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37081 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
79cfddf646c3d235df095f2ffdfd4d9603475192 13-May-2007 Chris Lattner <sabre@nondot.org> Fix Transforms/GlobalOpt/2007-05-13-Crash.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37020 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
ecd94c804a563f2a86572dcf1d2e81f397e19daa 06-May-2007 Nick Lewycky <nicholas@mxc.ca> Fix typo in comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36873 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
1997473cf72957d0e70322e2fe6fe2ab141c58a6 03-May-2007 Devang Patel <dpatel@apple.com> Drop 'const'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
3e15bf33e024b9df9e89351a165acfdb1dde51ed 02-May-2007 Devang Patel <dpatel@apple.com> Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36652 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
794fd75c67a2cdc128d67342c6d88a504d186896 01-May-2007 Devang Patel <dpatel@apple.com> Do not use typeinfo to identify pass in pass manager.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c763552299165b88d34a7d4f2d76ff413cbc7f67 12-Apr-2007 Lauro Ramos Venancio <lauro.venancio@gmail.com> Implement the "thread_local" keyword.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35950 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
4913bf47fddaafaf21d2657fd06eed5e48bc8eb9 05-Apr-2007 Chris Lattner <sabre@nondot.org> Fix Transforms/GlobalOpt/2007-04-05-Crash.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35689 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
cae5754619433aed7be74abbf1c0551a82d369cb 02-Mar-2007 Reid Spencer <rspencer@reidspencer.com> Prefer non-virtual calls to ConstantInt::isZero over virtual calls to
Constant::isNullValue() in situations where it is possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34821 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
9d6565a5b1fbc4286d6ee638d8f47a3171a9ed7e 15-Feb-2007 Reid Spencer <rspencer@reidspencer.com> For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34293 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
1ccd185cb49d81465a2901622e58ceae046d1d83 12-Feb-2007 Chris Lattner <sabre@nondot.org> stop using methods that take vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34205 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
046800a7125cd497613efc0e1ea15cb595666585 11-Feb-2007 Chris Lattner <sabre@nondot.org> simplify name juggling through the use of Value::takeName.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34175 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
9133fe28954d498fc4de13064c7d65bd811de02c 06-Feb-2007 Reid Spencer <rspencer@reidspencer.com> Apply the VISIBILITY_HIDDEN field to the remaining anonymous classes in
the Transforms library. This reduces debug library size by 132 KB, debug
binary size by 376 KB, and reduces link time for llvm tools slightly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
832254e1c2387c0cbeb0a820b8315fbe85cb003a 02-Feb-2007 Reid Spencer <rspencer@reidspencer.com> Changes to support making the shift instructions be true BinaryOperators.
This feature is needed in order to support shifts of more than 255 bits
on large integer types. This changes the syntax for llvm assembly to
make shl, ashr and lshr instructions look like a binary operator:
shl i32 %X, 1
instead of
shl i32 %X, i8 1
Additionally, this should help a few passes perform additional optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
699d144a4b726e11d5e72e23ab9b7b665ca9341f 31-Jan-2007 Chris Lattner <sabre@nondot.org> eliminate temporary vectors


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33712 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
55eb1c47de30a6b4e8707b6392e878e32a6583e9 31-Jan-2007 Chris Lattner <sabre@nondot.org> eliminate temporary vectors


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
79066fa6acce02c97c714a5a6e151ed8a249721c 31-Jan-2007 Chris Lattner <sabre@nondot.org> Adjust #includes to match movement of constant folding code from transformutils to libanalysis.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6c1f56574c8a0ba70480b7c65c4ec3847ff70864 31-Jan-2007 Chris Lattner <sabre@nondot.org> adjust to api change


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33671 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
5cbf985dcbc89fba3208e7baf8b6f488b06d3ec9 30-Jan-2007 Reid Spencer <rspencer@reidspencer.com> For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33663 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
24d6da5fedcf39891f7d8c5b031c01324b3db545 21-Jan-2007 Reid Spencer <rspencer@reidspencer.com> For PR970:
Clean up handling of isFloatingPoint() and dealing with PackedType.
Patch by Gordon Henriksen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33415 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
97d1fad3d2e5aac2a89beacc3961ff9451841248 12-Jan-2007 Chris Lattner <sabre@nondot.org> Branch conditions must be i1


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33129 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
579dca12c2cfd60bc18aaadbd5331897d48fec29 12-Jan-2007 Reid Spencer <rspencer@reidspencer.com> Implement review feedback for the ConstantBool->ConstantInt merge. Chris
recommended that getBoolValue be replaced with getZExtValue and that
get(bool) be replaced by get(const Type*, uint64_t). This implements
those changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33110 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
4fe16d607d11e29d742208894909733f5ad01f8f 11-Jan-2007 Reid Spencer <rspencer@reidspencer.com> Rename BoolTy as Int1Ty. Patch by Sheng Zhou.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33076 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6b6b6ef1677fa71b1072c2911b4c1f9524a558c9 11-Jan-2007 Zhou Sheng <zhousheng00@gmail.com> For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33073 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
39ff1e2afc07acf4c29af48853b09e15c41875d2 10-Jan-2007 Chris Lattner <sabre@nondot.org> Fix a bug in heap-sra that caused compilation failure of office-ispell.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c5b206b6be61d0d933b98b6af5e22f42edd48ad1 31-Dec-2006 Reid Spencer <rspencer@reidspencer.com> For PR950:
This patch replaces signed integer types with signless ones:
1. [US]Byte -> Int8
2. [U]Short -> Int16
3. [U]Int -> Int32
4. [U]Long -> Int64.
5. Removal of isSigned, isUnsigned, getSignedVersion, getUnsignedVersion
and other methods related to signedness. In a few places this warranted
identifying the signedness information from other sources.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32785 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
e4d87aa2de6e52952dca73716386db09aad5a8fd 23-Dec-2006 Reid Spencer <rspencer@reidspencer.com> For PR950:
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
86453c52ba02e743d29c08456e51006500041456 19-Dec-2006 Chris Lattner <sabre@nondot.org> Eliminate static ctors due to Statistic objects


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
d977d8651a5cd26a3e1088267f31cade405f2adf 13-Dec-2006 Reid Spencer <rspencer@reidspencer.com> Replace inferred getCast(V,Ty) calls with more strict variants.
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match
the the casting mnemonics in the rest of LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
e81561909d128c6e2d8033cb5465a49b2596b26a 07-Dec-2006 Bill Wendling <isanbard@gmail.com> Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
ac0b6ae358944ae8b2b5a11dc08f52c3ed89f2da 06-Dec-2006 Chris Lattner <sabre@nondot.org> Detemplatize the Statistic class. The only type it is instantiated with
is 'unsigned'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
d0a6a7a0307f124d47df9c649946bcb0767c5631 30-Nov-2006 Chris Lattner <sabre@nondot.org> make it clear that this is always a zext


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32044 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
6e8fbad67554e0a605af59d072b4129a8706681e 30-Nov-2006 Chris Lattner <sabre@nondot.org> One more bugfix, 3 cases of making casts explicit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
9a989f0f97dfb96477e5fec080c170f34930a7fe 30-Nov-2006 Chris Lattner <sabre@nondot.org> Fix a bug in globalopt due to the recent cast patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
3da59db637a887474c1b1346c1f3ccf53b6c4663 27-Nov-2006 Reid Spencer <rspencer@reidspencer.com> For PR950:
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
0a81aac4b46eed130d20714af5a1c01b05d0275e 26-Nov-2006 Bill Wendling <isanbard@gmail.com> Replace #include <iostream> with llvm_* streams.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
3ed469ccd7b028a030b550d84b7336d146f5d8fa 02-Nov-2006 Reid Spencer <rspencer@reidspencer.com> For PR786:
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31380 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
25de4e5c21b8ef1bbf6d625de548ca3508c58947 01-Nov-2006 Chris Lattner <sabre@nondot.org> Fix GlobalOpt/2006-11-01-ShrinkGlobalPhiCrash.ll and McGill/chomp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31352 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b83eb6447ba155342598f0fabe1f08f5baa9164a 20-Oct-2006 Reid Spencer <rspencer@reidspencer.com> For PR950:
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31063 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
596721f0d7e59e5092ff89b2dd3ba4abeffc43e5 01-Oct-2006 Chris Lattner <sabre@nondot.org> Fix debug output


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8639503abe611a6655fc7ac78537770ce5983cb0 01-Oct-2006 Chris Lattner <sabre@nondot.org> Implement SRA of heap allocations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
cff1673182b239a8b8a53ac68fc48fe93161357e 30-Sep-2006 Chris Lattner <sabre@nondot.org> Add some ifdef'd out debug info


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30676 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
47811b76ca92ddfebdd73c633d04ba8a4f5b7b59 29-Sep-2006 Chris Lattner <sabre@nondot.org> Eliminate ConstantBool::True and ConstantBool::False. Instead, provide
ConstantBool::getTrue() and ConstantBool::getFalse().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30665 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b74ed07bfd3af42331b1964c24c39912610a08f4 14-Sep-2006 Anton Korobeynikov <asl@math.spbu.ru> Adding dllimport, dllexport and external weak linkage types.
DLL* linkages got full (I hope) codegeneration support in C & both x86
assembler backends.
External weak linkage added for future use, we don't provide any
codegeneration, etc. support for it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30374 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7f8897f22e88271cfa114998a4d6088e7c8e8e11 28-Aug-2006 Chris Lattner <sabre@nondot.org> eliminate RegisterOpt. It does the same thing as RegisterPass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29925 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7cd580f0b7cf5f49ccd75bb747d6627292c8fe73 07-Jul-2006 Chris Lattner <sabre@nondot.org> Fix PR820 and Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29071 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
dac58ad983c62b49629e1f2969f4e0a621167d63 23-Jan-2006 Chris Lattner <sabre@nondot.org> Make iostream #inclusion explicit


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
14b0529532904b9e5a1e34526b4a3209f3e5bc62 05-Nov-2005 Nate Begeman <natebegeman@mac.com> Add support alignment of allocation instructions.
Add support for specifying alignment and size of setjmp jmpbufs.

No targets currently do anything with this information, nor is it presrved
in the bytecode representation. That's coming up next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
e9c6d3637752b940a3c280196b0f594b65725e54 25-Oct-2005 Alkis Evlogimenos <alkis@evlogimenos.com> Stop using deprecated types


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23973 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
9a5582f2516634f5b66c9bbdbab5360d6eb3ef35 28-Sep-2005 Chris Lattner <sabre@nondot.org> Fix a regression in my previous patch, fixing GlobalOpt/2005-09-27-Crash.ll
and PR632.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23484 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a9ec8ab32bce9021c9501b45eea6bbc76ffeb207 27-Sep-2005 Chris Lattner <sabre@nondot.org> Add support for external calls that we know how to constant fold. This implements
ctor-list-opt.ll:CTOR8


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
231308c54538c1f50d7175f76b26e3d368e4703e 27-Sep-2005 Chris Lattner <sabre@nondot.org> Fix a bug where we would evaluate stores into linkonce objects which could be
potentially replaced at link-time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
cd27142cc8d09dcab8110a7ef31e5cd6767d8b93 27-Sep-2005 Chris Lattner <sabre@nondot.org> Implement support for static constructors with calls in them. This is useful
because gccas runs globalopt before inlining.

This implements ctor-list-opt.ll:CTOR7


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23462 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8a7cc6e71ca9bedf97abfae2ec9a5e9af212dc15 27-Sep-2005 Chris Lattner <sabre@nondot.org> Refactor this code a bit, no functionality changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23460 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
ff0c1ef9eb9266acaf4bb956de17d6f6ceab87e0 26-Sep-2005 Chris Lattner <sabre@nondot.org> Remove some dead code. ctor evaluation subsumes empty ctor elim


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a22fdb0a37f935fc3e3391d47d64267a92cfc2e8 26-Sep-2005 Chris Lattner <sabre@nondot.org> Add support for alloca, implementing ctor-list-opt.ll:CTOR6


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23452 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
aae4a1cd3f5d41d0b909a75b4f5699b20605db5e 26-Sep-2005 Chris Lattner <sabre@nondot.org> Add a debug printout, fix a crash on kc++


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23450 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
798b4d5bb32d51f9fed87893f65ea571fd90b161 26-Sep-2005 Chris Lattner <sabre@nondot.org> Implement loads/stores through GEP's of globals. This implements
ctor-list-opt.ll:CTOR5.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23449 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
0b142e39209677daa4e62cf0dbe6bae07d30e0f3 26-Sep-2005 Chris Lattner <sabre@nondot.org> Replace TraverseGEPInitializer with ConstantFoldLoadThroughGEPConstantExpr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23447 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
562a055ca731c2f673cc4cfb60de963fce5e38a6 26-Sep-2005 Chris Lattner <sabre@nondot.org> add a comment


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23442 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
04de1cfb2b58cd3fff06d0328a733082ce775ab6 26-Sep-2005 Chris Lattner <sabre@nondot.org> Add support for getelementptr, load, and correctly reject volatile stores.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23441 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
cdf98bed968ff76b8f310a2adae5811f5ba88ec4 26-Sep-2005 Chris Lattner <sabre@nondot.org> Add support for br/brcond/switch and phi


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23439 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
79c1101947101ff1585a38dc69d1f1079d44bb04 26-Sep-2005 Chris Lattner <sabre@nondot.org> Add a simple interpreter to this code, allowing us to statically evaluate
global ctors that are simple enough. This implements ctor-list-opt.ll:CTOR2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23437 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
db973e60ced33cfa0332462b1a2d5ae1ae15ad25 26-Sep-2005 Chris Lattner <sabre@nondot.org> factor some code into a InstallGlobalCtors method, add comments. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23435 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7d8e58f38425692e203edc45e87dcf3dcd65dae6 26-Sep-2005 Chris Lattner <sabre@nondot.org> Make the global opt optimizer work on modules with a null terminator, by
accepting the null even with a non-65535 init prio


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23434 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b1ab4580478c90375abec5e2b6e89dc1a15fa98b 26-Sep-2005 Chris Lattner <sabre@nondot.org> Factor this code out into a few methods.
Implement the start of global ctor optimization. It is currently smart
enough to remove the global ctor for cases like this:

struct foo {
foo() {}
} x;

... saving a bit of startup time for the program.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
553ca5262361e520f98a72d1a109d6b10d1918ee 15-Jun-2005 Chris Lattner <sabre@nondot.org> Do not promote globals only used by main to locals if there are constantexprs
or other uses hanging off of them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
fb217adf92cbfd045614a652be63c710ce6a263d 09-May-2005 Chris Lattner <sabre@nondot.org> Convert non-address taken functions with C calling conventions to fastcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21791 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
fd93908ae8b9684fe71c239e3c6cfe13ff6a2663 22-Apr-2005 Misha Brukman <brukman+llvm@gmail.com> Remove trailing whitespace


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21427 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
e4d5c441e04bdc00ccf1804744af670655123b07 15-Mar-2005 Chris Lattner <sabre@nondot.org> This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20597 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
35c81b0b120f87373584f2e238e4d77f9d2ae88f 27-Feb-2005 Chris Lattner <sabre@nondot.org> Teach globalopt how memset/cpy/move affect memory, to allow better optimization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20352 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
1f21ef1511ce003fc177121b980e783b83992f82 23-Feb-2005 Chris Lattner <sabre@nondot.org> make this more efficient. Scan up to 16 nodes, not the whole list.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
f64ea9d1221f52c47fed2ea86a74946c05f224ad 10-Feb-2005 Alkis Evlogimenos <alkis@evlogimenos.com> Localize globals if they are only used in main(). This replaces the
global with an alloca, which eventually gets promoted into a
register. This enables a lot of other optimizations later on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20109 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
d514d8294d13e6a695ed324b415d3a9263313355 01-Feb-2005 Chris Lattner <sabre@nondot.org> Adjust to changes in APIs


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19958 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
4d0801b243ebb05954ec2173b45ed9f892ef961a 08-Jan-2005 Chris Lattner <sabre@nondot.org> Fix VS warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19382 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
38c2556d0c02f7aca08732225ae1c97975f55aa0 12-Dec-2004 Chris Lattner <sabre@nondot.org> Properly implement copying of a global, fixing the 255.vortex & povray
failures from last night.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18832 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
077f1a82923fee977569df5f2bd4ba914e6ee22e 12-Dec-2004 Chris Lattner <sabre@nondot.org> Though the previous xform applies to literally dozens (hundreds?) of variables
in SPEC, the subsequent optimziations that we are after don't play with
with FP values, so disable this xform for them. Really we just don't want
stuff like:

double G; (always 0 or 412312.312)
= G;

turning into:

bool G_b;
= G_b ? 412312.312 : 0;

We'd rather just do the load.

-Chris


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18819 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
96a86b2993c03be1de934b2c4e10ed08dbacfe0a 12-Dec-2004 Chris Lattner <sabre@nondot.org> If a variable can only hold two values, and is not already a bool, shrink it
down to actually BE a bool. This allows simple value range propagation
stuff work harder, deleting comparisons in bzip2 in some hot loops.

This implements GlobalOpt/integer-bool.ll, which is the essence of the
loop condition distilled into a testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18817 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
fa07e4fc302b1e274c292c2db4604e61d69458d5 02-Dec-2004 Chris Lattner <sabre@nondot.org> Implement a FIXME by checking to make sure that a malloc is not being used
in scary and unknown ways before we promote it. This fixes the miscompilation
of 188.ammp that has been plauging us since a globalopt patch went in.

Thanks a ton to Tanya for helping me diagnose the problem!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18418 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
bc965b97ade56092b5fe4251eb68695271f1d82a 02-Dec-2004 Chris Lattner <sabre@nondot.org> Fix a minor bug where we set a var to initialized on malloc, not on store.

This doesn't fix anything that I'm aware of, just noticed it by inspection


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18417 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
bd38edfe236944ebecbbf84ef9ea75d5412737b5 14-Nov-2004 Chris Lattner <sabre@nondot.org> If a global is just loaded and restored, realize that it is not changing
value. This allows us to turn more globals into constants and eliminate them.
This patch implements GlobalOpt/load-store-global.llx.

Note that this patch speeds up 255.vortex from:

Output/255.vortex.out-cbe.time:program 7.640000
Output/255.vortex.out-llc.time:program 9.810000

to:

Output/255.vortex.out-cbe.time:program 7.250000
Output/255.vortex.out-llc.time:program 9.490000

Which isn't bad at all!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17746 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
e9ece2a7462c29f2c57c0b0e063f950514f41ab4 22-Oct-2004 Chris Lattner <sabre@nondot.org> *** empty log message ***


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17161 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7a7ed0274d01efb2e12a32fd5fee6aa9596b0b9a 16-Oct-2004 Chris Lattner <sabre@nondot.org> Add support for the undef value. Implement a new optimization based on globals
that are initialized with undef. When promoting malloc to a global, start out
initialized to undef


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b23cd2f6887d2d6333bc596d88eb93aa2e2a04e4 14-Oct-2004 Chris Lattner <sabre@nondot.org> Fix a bug John tracked down in libstdc++ where we were incorrectly deleting
weak functions. Thanks for finding this John!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16997 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
30ba5690cf7a6f4db8913463d03f239f82d17440 11-Oct-2004 Chris Lattner <sabre@nondot.org> This patch implements two things (sorry).

First, it allows SRA of globals that have embedded arrays, implementing
GlobalOpt/globalsra-partial.llx. This comes up infrequently, but does allow,
for example, deleting several stores to dead parts of globals in dhrystone.

Second, this implements GlobalOpt/malloc-promote-*.llx, which is the
following nifty transformation:

Basically if a global pointer is initialized with malloc, and we can tell
that the program won't notice, we transform this:

struct foo *FooPtr;
...
FooPtr = malloc(sizeof(struct foo));
...
FooPtr->A FooPtr->B

Into:

struct foo FooPtrBody;
...
FooPtrBody.A FooPtrBody.B

This comes up occasionally, for example, the 'disp' global in 183.equake (where
the xform speeds the CBE version of the program up from 56.16s to 52.40s (7%)
on apoc), and the 'desired_accept', 'fixLRBT', 'macroArray', & 'key_queue'
globals in 300.twolf (speeding it up from 22.29s to 21.55s (3.4%)).

The nice thing about this xform is that it exposes the resulting global to
global variable optimization and makes alias analysis easier in addition to
eliminating a few loads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16916 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
708148e41f8f7c1e24c73cfd943645b13a1e05f9 11-Oct-2004 Chris Lattner <sabre@nondot.org> Just because we cannot completely eliminate all uses of a global, we can
still optimize away all of the indirect calls and loads, etc from it.
This turns code like this:

if (G != 0)
G();

into
if (G != 0)
ActualCallee();

This triggers a couple of times in gcc and libstdc++.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16901 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8be8012ba493f1b17967c4ad7863c5709bf34a75 10-Oct-2004 Chris Lattner <sabre@nondot.org> Fix 2004-10-10-CastStoreOnce.llx, by adjusting types back if we strip off a cast


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16878 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
c4d81b0388dff9f38e1387bb223cc7b514c06d01 10-Oct-2004 Chris Lattner <sabre@nondot.org> Implement GlobalOpt/deadglobal-2.llx, deletion of globals that are only
stored to, but are stored at variable indexes. This occurs at least in
176.gcc, but probably others, and we should handle it for completeness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16876 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
031955d4623193b1c4163bd43db0eaaf6b08c27b 10-Oct-2004 Chris Lattner <sabre@nondot.org> Avoid calling use_size() which could (in theory) be expensive if the global
has a large number of users. Instead, just keep track of whether we're
making changes as we do so.

This patch has no functionlity changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16874 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
9b34a6101908c36df659fe0b188713c949a32304 09-Oct-2004 Chris Lattner <sabre@nondot.org> Eliminate global pointers that are only stored a single value and null if
we know that all uses of the global will trap if the pointer contained is
null. In this case, we forward substitute the stored value to any uses.

This has the effect of devirtualizing trivial globals in trivial cases. For
example, 164.gzip contains this:

gzip.h:extern int (*read_buf) OF((char *buf, unsigned size));
bits.c: read_buf = file_read;
deflate.c: lookahead = read_buf((char*)window,
deflate.c: n = read_buf((char*)window+strstart+lookahead, more);

Since read_buf has to point to file_read at every use, we just replace
the calls through read_buf with a direct call to file_read.

This occurs in several benchmarks, including 176.gcc and 164.gzip. Direct
calls are good and stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16871 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
930f475604bcd8835197df0dac0c63235f8f1bb3 09-Oct-2004 Chris Lattner <sabre@nondot.org> Fix infinite loop due to iteration


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16864 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
8f57e9c083b1e1aa9677e83284969ab65b975821 09-Oct-2004 Chris Lattner <sabre@nondot.org> If we found a dead global, we should at least delete it...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16858 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
a4be1dc0a192175bbc561a633c0b7197853e6a74 08-Oct-2004 Chris Lattner <sabre@nondot.org> * Pull out the meat of runOnModule into another function for clarity.
* Do not lead dangling dead constants prevent optimization
* Iterate global optimization while we're making progress.

These changes allow us to be more aggressive, handling cases like
GlobalOpt/iterate.llx without a problem (turning it into 'ret int 0').


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16857 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
e40e2d1a71777289a8bfb9d77452754478722e55 08-Oct-2004 Chris Lattner <sabre@nondot.org> We might as well delete the known-dead global sooner rather than later since
we know it is dead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
670c889ac90e79fc6b1f9f18e78e536562d86f87 08-Oct-2004 Chris Lattner <sabre@nondot.org> Implement SRA for global variables. This allows the other global variable
optimizations to trigger much more often. This allows the elimination of
several dozen more global variables in Programs/External. Note that we only
do this for non-constant globals: constant globals will already be optimized
out if the accesses to them permit it.

This implements Transforms/GlobalOpt/globalsra.llx


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16842 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
cf4d2a569972b5b4f0978e88fa775870dabcfed0 07-Oct-2004 Chris Lattner <sabre@nondot.org> Improve comments, no functionality changes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16814 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
3602549c3dbce144bdfc5b0db784c60880a3062f 07-Oct-2004 Chris Lattner <sabre@nondot.org> Fix a bug in the safety analysis routine


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16804 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7a90b68e5c85fe11a4ccc386be9c5fcddd4a8b61 07-Oct-2004 Chris Lattner <sabre@nondot.org> * Rename pass to globalopt, since we do more than just constify
* Instead of handling dead functions specially, just nuke them.
* Be more aggressive about cleaning up after constification, in
particular, handle getelementptr instructions and constantexprs.
* Be a little bit more structured about how we process globals.

*** Delete globals that are only stored to, and never read. These are
clearly not useful, so they should go. This implements deadglobal.llx

This last one triggers quite a few times. In particular, 2208 in the
external tests, 1865 of which are in 252.eon. This shrinks eon from
1995094 to 1732341 bytes of bytecode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16802 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
e47ba74b07b2a6015239bcbabba09750580aeced 06-Oct-2004 Chris Lattner <sabre@nondot.org> Implement GlobalConstifier/trivialstore.llx, and also do some
simplifications of the resultant program to avoid making later passes
do it all.

This allows us to constify globals that just have the same constant that
they are initialized stored into them.

Suprisingly this comes up ALL of the freaking time, dozens of times in
SPEC, 30 times in vortex alone.

For example, on 256.bzip2, it allows us to constify these two globals:

%smallMode = internal global ubyte 0 ; <ubyte*> [#uses=8]
%verbosity = internal global int 0 ; <int*> [#uses=49]

Which (with later optimizations) results in the bytecode file shrinking
from 82286 to 69686 bytes! Lets hear it for IPO :)

For the record, it's nuking lots of "if (verbosity > 2) { do lots of stuff }"
code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
b12914bfc0f76a7a48357162d5f4c39a1343e69b 20-Sep-2004 Chris Lattner <sabre@nondot.org> 'Pass' should now not be derived from by clients. Instead, they should derive
from ModulePass. Instead of implementing Pass::run, then should implement
ModulePass::runOnModule.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16436 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
551ccae044b0ff658fe629dd67edd5ffe75d10e8 02-Sep-2004 Reid Spencer <rspencer@reidspencer.com> Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
77a2a9d9dae5dbe551cec102e37ea02f45da44ed 14-Aug-2004 Chris Lattner <sabre@nondot.org> Implement test/Regression/Transforms/GlobalConstifier/phi-select.llx
This allows more globals to be marked constant, particularly global arrays.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15735 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
9ce300013d5c5b9e2c7e26626ddbc8f3a42bdb88 20-Jul-2004 Chris Lattner <sabre@nondot.org> Ignore instructions that are in trivially dead functions. This allows us
to constify 14 globals instead of 4 in a trivial C++ testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15027 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
96940cb5223d8441f3710b75063a0ee5a3c824ed 18-Jul-2004 Chris Lattner <sabre@nondot.org> Strip out and simplify some code. This also fixes the regression last
night compiling cfrac. It did not realize that code like this:

int G; int *H = &G;

takes the address of G.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14973 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
518310cb0d136906ff0a99d7a24cb460794de5bf 18-Jul-2004 Reid Spencer <rspencer@reidspencer.com> bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14953 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
7d90a2738e889efc5ff6e64c015c3b5cf5324aff 27-Feb-2004 Chris Lattner <sabre@nondot.org> setcond instructions don't have aliasing implications.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11919 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/GlobalOpt.cpp
079236d1c9909365ffd0ef06831523c87335bb4a 25-Feb-2004 Chris Lattner <sabre@nondot.org> My faith in programmers has been found to be totally misplaced. One would
assume that if they don't intend to write to a global variable, that they
would mark it as constant. However, there are people that don't understand
that the compiler can do nice things for them if they give it the information
it needs.

This pass looks for blatently obvious globals that are only ever read from.
Though it uses a trivially simple "alias analysis" of sorts, it is still able
to do amazing things to important benchmarks. 253.perlbmk, for example,
contains several ***GIANT*** function pointer tables that are not marked
constant and should be. Marking them constant allows the optimizer to turn
a whole bunch of indirect calls into direct calls. Note that only a link-time
optimizer can do this transformation, but perlbmk does have several strings
and other minor globals that can be marked constant by this pass when run
from GCCAS.

176.gcc has a ton of strings and large tables that are marked constant, both
at compile time (38 of them) and at link time (48 more). Other benchmarks
give similar results, though it seems like big ones have disproportionally
more than small ones.

This pass is extremely quick and does good things. I'm going to enable it
in gccas & gccld. Not bad for 50 SLOC.


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