1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

1213 Commits

Author SHA1 Message Date
Dan Gohman
7924aacfe4 Fix indentation.
llvm-svn: 92733
2010-01-05 16:20:55 +00:00
Benjamin Kramer
e90a3c66c4 Avoid going through the LLVMContext for type equality where it's safe to dereference the type pointer.
llvm-svn: 92726
2010-01-05 13:12:22 +00:00
David Greene
6b20914d8a Change errs() to dbgs().
llvm-svn: 92639
2010-01-05 01:28:37 +00:00
David Greene
a48859b420 Change errs() to dbgs().
llvm-svn: 92636
2010-01-05 01:28:29 +00:00
David Greene
6c314b2f2b Change errs() to dbgs().
llvm-svn: 92633
2010-01-05 01:28:12 +00:00
David Greene
706266dce6 Change errs() to dbgs().
llvm-svn: 92631
2010-01-05 01:28:07 +00:00
David Greene
04f5c49e6f Change errs() to dbgs().
llvm-svn: 92629
2010-01-05 01:28:05 +00:00
David Greene
e5c3a6f658 Change errs() to dbgs().
llvm-svn: 92627
2010-01-05 01:27:54 +00:00
David Greene
0d082a1e9d Change errs() to dbgs().
llvm-svn: 92625
2010-01-05 01:27:51 +00:00
Chris Lattner
84e9de4a58 Final step in the metadata API restructuring: move the
getMDKindID/getMDKindNames methods to LLVMContext (and add
convenience methods to Module), eliminating MetadataContext.
Move the state that it maintains out to LLVMContext.

llvm-svn: 92259
2009-12-29 09:01:33 +00:00
Chris Lattner
9ec640a902 This is a major cleanup of the instruction metadata interfaces that
I asked Devang to do back on Sep 27.  Instead of going through the
MetadataContext class with methods like getMD() and getMDs(), just
ask the instruction directly for its metadata with getMetadata()
and getAllMetadata().

This includes a variety of other fixes and improvements: previously
all Value*'s were bloated because the HasMetadata bit was thrown into
value, adding a 9th bit to a byte.  Now this is properly sunk down to
the Instruction class (the only place where it makes sense) and it
will be folded away somewhere soon.

This also fixes some confusion in getMDs and its clients about 
whether the returned list is indexed by the MDID or densely packed.
This is now returned sorted and densely packed and the comments make
this clear.

This introduces a number of fixme's which I'll follow up on.

llvm-svn: 92235
2009-12-28 23:41:32 +00:00
Chris Lattner
cd3aa9d1ff rename getMDKind -> getMDKindID, make it autoinsert if an MD Kind
doesn't exist already, eliminate registerMDKind.  Tidy up a bunch
of random stuff.

llvm-svn: 92225
2009-12-28 20:45:51 +00:00
Duncan Sands
897f9579d6 Teach GlobalOpt to delete aliases with internal linkage (after
forwarding any uses).  GlobalDCE can also do this, but is only
run at -O3.

llvm-svn: 90850
2009-12-08 10:10:20 +00:00
Dan Gohman
58bb87921b 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.

llvm-svn: 89659
2009-11-23 16:22:21 +00:00
Nick Lewycky
8cbd0c3156 Remove unused LLVMContext.
llvm-svn: 89642
2009-11-23 03:29:18 +00:00
Dan Gohman
44ddc50043 Extend CaptureTracking to indicate when a value is never stored, even
if it is not ultimately captured. Teach BasicAliasAnalysis that a 
local object address which does not escape and is never stored does
not alias with a value resulting from a load.

llvm-svn: 89398
2009-11-19 21:57:48 +00:00
Devang Patel
04a40c8ff7 Remove debug info attached with an instruction.
llvm-svn: 89016
2009-11-17 00:47:06 +00:00
Chris Lattner
9a1f2aaff0 use isInstructionTriviallyDead, as pointed out by Duncan
llvm-svn: 87035
2009-11-12 21:58:18 +00:00
Chris Lattner
00a9240c9c implement a nice little efficiency hack in the inliner. Since we're now
running IPSCCP early, and we run functionattrs interlaced with the inliner,
we often (particularly for small or noop functions) completely propagate
all of the information about a call to its call site in IPSSCP (making a call
dead) and functionattrs is smart enough to realize that the function is
readonly (because it is interlaced with inliner).

To improve compile time and make the inliner threshold more accurate, realize
that we don't have to inline dead readonly function calls.  Instead, just 
delete the call.  This happens all the time for C++ codes, here are some
counters from opt/llvm-ld counting the number of times calls were deleted vs
inlined on various apps:

Tramp3d opt:
  5033 inline                - Number of call sites deleted, not inlined
 24596 inline                - Number of functions inlined
llvm-ld:
  667 inline           - Number of functions deleted because all callers found
  699 inline           - Number of functions inlined

483.xalancbmk opt:
  8096 inline                - Number of call sites deleted, not inlined
 62528 inline                - Number of functions inlined
llvm-ld:
   217 inline           - Number of allocas merged together
  2158 inline           - Number of functions inlined

471.omnetpp:
  331 inline                - Number of call sites deleted, not inlined
 8981 inline                - Number of functions inlined
llvm-ld:
  171 inline           - Number of functions deleted because all callers found
  629 inline           - Number of functions inlined


Deleting a call is much faster than inlining it, and is insensitive to the
size of the callee. :)

llvm-svn: 86975
2009-11-12 07:56:08 +00:00
Victor Hernandez
3c98070f2c 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
llvm-svn: 86676
2009-11-10 08:32:25 +00:00
Victor Hernandez
4613fc8629 - new SROA mallocs should have the mallocs running-or'ed, not the malloc's bitcast
- fix ProcessInternalGlobal() debug output

llvm-svn: 86317
2009-11-07 00:41:19 +00:00
Victor Hernandez
8736a8fca4 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.

llvm-svn: 86311
2009-11-07 00:16:28 +00:00
Chris Lattner
903ae55e1c remove a bunch of extraneous LLVMContext arguments
from various APIs, addressing PR5325.

llvm-svn: 86231
2009-11-06 04:27:31 +00:00
Victor Hernandez
a5a12cd62e Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM
llvm-svn: 86213
2009-11-06 01:33:24 +00:00
Dan Gohman
3c155aa3cd Update various Loop optimization passes to cope with the possibility that
LoopSimplify form may not be available.

llvm-svn: 86175
2009-11-05 21:11:53 +00:00
Victor Hernandez
21ec158c23 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.

llvm-svn: 86077
2009-11-05 00:03:03 +00:00
Benjamin Kramer
c6b59b889b Eliminate some temporaries.
llvm-svn: 85896
2009-11-03 12:52:50 +00:00
Chris Lattner
888d78216f cleanups, switch GlobalDCE to SmallPtrSet instead of std::set
llvm-svn: 85730
2009-11-01 19:03:42 +00:00
Douglas Gregor
16c6819959 Reverting 85714, 85715, 85716, which are breaking the build
llvm-svn: 85717
2009-11-01 16:42:53 +00:00
Dan Gohman
1d0b06c139 Remove the #include of Pass.h from PassManager.h. This breaks a significant
#include dependency, as frontends commonly pull in PassManager.h.

llvm-svn: 85714
2009-11-01 15:20:19 +00:00
Chris Lattner
d8f9d01b76 teach ipsccp and ipconstprop that a blockaddress doesn't 'take the address' of a function
in a way that should prevent ip constprop.  This allows clang/test/CodeGen/indirect-goto.c
to pass with the new indirect goto lowering.

llvm-svn: 85709
2009-11-01 06:11:53 +00:00
Chris Lattner
2bbe57b2b8 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.

llvm-svn: 85699
2009-11-01 01:27:45 +00:00
Chris Lattner
48de74645e adjust a couple xforms to work with null bb's in BlockAddress.
llvm-svn: 85680
2009-10-31 20:13:24 +00:00
Chris Lattner
e83554145a just for the hell of it, allow globalopt to statically evaluate
static constructors with indirect gotos :)

llvm-svn: 85495
2009-10-29 05:51:50 +00:00
Chris Lattner
a0e35cae82 teach various passes about blockaddress. We no longer
crash on any clang tests.

llvm-svn: 85465
2009-10-29 01:21:20 +00:00
Victor Hernandez
917cf94b22 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.

llvm-svn: 85421
2009-10-28 20:18:55 +00:00
Devang Patel
de81397884 llvm.dbg.global_variables do not exist anymore.
llvm-svn: 85402
2009-10-28 16:51:52 +00:00
Chris Lattner
f605b2e8f9 Previously, all operands to Constant were themselves constant.
In the new world order, BlockAddress can have a BasicBlock operand.
This doesn't permute much, because if you have a ConstantExpr (or
anything more specific than Constant) we still know the operand has
to be a Constant.

llvm-svn: 85375
2009-10-28 05:14:34 +00:00
Victor Hernandez
0f662a7acf Rename MallocFreeHelper as MemoryBuiltins
llvm-svn: 85286
2009-10-27 20:05:49 +00:00
Victor Hernandez
6c86b93663 Rename MallocHelper as MallocFreeHelper, since it now also identifies calls to free()
llvm-svn: 85181
2009-10-26 23:58:56 +00:00
Nick Lewycky
2b8400628d Remove includes of Support/Compiler.h that are no longer needed after the
VISIBILITY_HIDDEN removal.

llvm-svn: 85043
2009-10-25 06:57:41 +00:00
Nick Lewycky
711c726c97 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.

llvm-svn: 85042
2009-10-25 06:33:48 +00:00
Victor Hernandez
e8998896f5 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.

llvm-svn: 84987
2009-10-24 04:23:03 +00:00
Devang Patel
f9d56f4830 Derive metadata hierarchy from Value instead of User.
llvm-svn: 84801
2009-10-21 23:57:35 +00:00
Devang Patel
64fe3f9be0 Do not remove dead metadata for now.
llvm-svn: 84731
2009-10-21 02:21:34 +00:00
Victor Hernandez
a666c49572 Malloc calls are marked NoAlias, so the code below the isMalloc() check makes it redundant. Removing the isMalloc() check.
llvm-svn: 84541
2009-10-19 21:47:22 +00:00
Chris Lattner
6077ca46bb remove the IndMemRemPass, which only made sense for when malloc/free were intrinsic
instructions.

llvm-svn: 84404
2009-10-18 05:02:09 +00:00
Victor Hernandez
a25a2890fa Remove MallocInst from LLVM Instructions.
llvm-svn: 84299
2009-10-17 01:18:07 +00:00
Victor Hernandez
4d7283f82c Autoupgrade malloc insts to malloc calls.
Update testcases that rely on malloc insts being present.

Also prematurely remove MallocInst handling from IndMemRemoval and RaiseAllocations to help pass tests in this incremental step.

llvm-svn: 84292
2009-10-17 00:00:19 +00:00
Victor Hernandez
00adf339dd HeapAllocSRoA also needs to check if malloc array size can be computed.
llvm-svn: 84288
2009-10-16 23:12:25 +00:00