1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-25 05:52:53 +02:00
Commit Graph

5883 Commits

Author SHA1 Message Date
Dan Gohman
e93b2dbc0f Avoid calling getUniqueExitBlocks from within LoopSimplify, as it depends
on loops having dedicated exits, which LoopSimplify can no longer always
guarantee.

llvm-svn: 86181
2009-11-05 21:48:32 +00:00
Dan Gohman
6a3eefbfeb LoopDeletion depends on loops having dedicated exits.
llvm-svn: 86180
2009-11-05 21:47:04 +00:00
Dan Gohman
f65735f0c5 The introduction of indirectbr meant the introduction of
unsplittable critical edges, which means the introduction of
loops which cannot be transformed to LoopSimplify form. Fix
LoopSimplify to avoid transforming such loops into invalid
code.

llvm-svn: 86176
2009-11-05 21:14:46 +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
Dan Gohman
cf44615b89 Teach LoopUnroll how to bail if LoopSimplify can't give it what it needs.
llvm-svn: 86164
2009-11-05 19:44:06 +00:00
Dan Gohman
0c3b2f8419 Call getAnalysis<LoopInfo> the normal way, instead of asking passed-in
LoopPassManager for it.

llvm-svn: 86163
2009-11-05 19:43:25 +00:00
Dan Gohman
a25cd27300 Delete an unused member variable.
llvm-svn: 86160
2009-11-05 19:33:15 +00:00
Dan Gohman
7e9c38c364 Add an assertion to catch indirectbr in SplitBlockPredecessors. This
makes several optimization passes abort in cases where they're currently
silently miscompiling code.

Remove the indirectbr assertion from SplitEdge. Indirectbr is only
a problem for critical edges, and SplitEdge defers to SplitCriticalEdge
to handle those, and SplitCriticalEdge has its own assertion for
indirectbr.

llvm-svn: 86147
2009-11-05 18:25:44 +00:00
Benjamin Kramer
a38019a3de Teach SimplifyLibCalls to fold memcmp calls with constant arguments.
llvm-svn: 86141
2009-11-05 17:44:22 +00:00
Benjamin Kramer
f10e3edefb Do map insert+find in one step. TODO -= 2.
llvm-svn: 86133
2009-11-05 14:33:27 +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
Chris Lattner
a003aee613 improve DSE when TargetData is not around, based on work by
Hans Wennborg!

llvm-svn: 86067
2009-11-04 23:20:12 +00:00
Chris Lattner
4864198071 Fix an iterator invalidation bug that happens when a hashtable
resizes in IPSCCP.  This fixes PR5394.

llvm-svn: 86036
2009-11-04 18:57:42 +00:00
Chris Lattner
d8ab8fbe9f move two functions up higher in the file. Delete a useless argument
to EmitGEPOffset.  

Implement some new transforms for optimizing 
subtracts of two pointer to ints into the same vector.  This happens
for C++ iterator idioms for example, stringmap takes a const char*
that points to the start and end of a string.  Once inlined, we want
the pointer difference to turn back into a length.

This is rdar://7362831.

llvm-svn: 86021
2009-11-04 08:05:20 +00:00
Chris Lattner
b634c6cdb5 reimplement multiple return value handling in IPSCCP, making it
more aggressive an correct.  This survives building llvm in 64-bit
mode with optimizations and the built llvm passes make check.

llvm-svn: 85973
2009-11-03 23:40:48 +00:00
Chris Lattner
10c341e8fa finish half thunk thought
llvm-svn: 85937
2009-11-03 20:52:57 +00:00
Chris Lattner
2aa5962af6 fix an IPSCCP bug I introduced when I changed IPSCCP to start working on
functions that don't have local linkage.  Basically, we need to be more
careful about propagating argument information to functions whose results
we aren't tracking.  This fixes a miscompilation of 
LLVMCConfigurationEmitter.cpp when built with an llvm-gcc that has ipsccp
enabled.

llvm-svn: 85923
2009-11-03 19:24:51 +00:00
Chris Lattner
bfe755788f fix a subtle bug I introduced when refactoring SCCP. Testcase
to follow.

llvm-svn: 85903
2009-11-03 16:50:11 +00:00
Benjamin Kramer
c6b59b889b Eliminate some temporaries.
llvm-svn: 85896
2009-11-03 12:52:50 +00:00
Chris Lattner
9d0f925cf0 remove a isFreeCall check: it is a callinst that can write to memory already.
llvm-svn: 85863
2009-11-03 05:33:46 +00:00
Ted Kremenek
cd7ab8bfa0 Alphabetize.
llvm-svn: 85859
2009-11-03 04:01:53 +00:00
Chris Lattner
b1dfdadabd turn IPSCCP back on now that the iterator invalidation bug is fixed.
llvm-svn: 85858
2009-11-03 03:42:51 +00:00
Chris Lattner
00c9eb665d fix a nasty iterator invalidation bug from my conversion from
std::map to DenseMap, exposed on release llvm-gcc bootstrap.

llvm-svn: 85840
2009-11-02 23:25:39 +00:00
Chris Lattner
6f515d4ba8 revert r8579[56], which are causing unhappiness in buildbot land.
llvm-svn: 85818
2009-11-02 19:31:10 +00:00
Chris Lattner
a1776913ab disable IPSCCP support for multiple return values, it is buggy, so just
disable it until I can fix it.

llvm-svn: 85810
2009-11-02 18:22:51 +00:00
Chris Lattner
f1afb57935 improve IPSCCP to be able to propagate the result of "!mayBeOverridden"
function to calls of that function, regardless of whether it has local
linkage or has its address taken.  Not escaping should only affect 
whether we make an aggressive assumption about the arguments to a 
function, not whether we can track the result of it.

llvm-svn: 85795
2009-11-02 07:33:59 +00:00
Chris Lattner
c9279a9b4d don't mark the arguments of prototype overdefined, they will never be queried.
llvm-svn: 85793
2009-11-02 06:34:04 +00:00
Chris Lattner
9c7e443b07 restore some code I removed in r85788, refactor it into
a shared place instead of duplicating it 4 times.

llvm-svn: 85792
2009-11-02 06:28:16 +00:00
Chris Lattner
23f5603692 remove some confused code that dates from when we had
"multiple return values" but not "first class aggregates"

llvm-svn: 85791
2009-11-02 06:17:06 +00:00
Chris Lattner
c670f866ce avoid redundant lookups in BBExecutable, and make it a SmallPtrSet.
llvm-svn: 85790
2009-11-02 06:11:23 +00:00
Chris Lattner
16b825e51f Use the libanalysis 'ConstantFoldLoadFromConstPtr' function
instead of reinventing SCCP-specific logic.  This gives us
new powers.

llvm-svn: 85789
2009-11-02 06:06:14 +00:00
Chris Lattner
32acebedf7 switch the main 'ValueState' map from being an std::map to being
a DenseMap.  Doing this required being aware of subtle iterator
invalidation issues, but it provides a big speedup.  In a 
release-asserts build, this sped up optimizing 403.gcc from
1.34s -> 0.79s (IPSCCP) and 1.11s -> 0.44s (SCCP).

This commit also conflates in a bunch of general cleanups, sorry.

llvm-svn: 85788
2009-11-02 05:55:40 +00:00
Chris Lattner
9fc809ca55 fix a bug exposed by moving SRoA earlier which caused a crash building kc++
llvm-svn: 85786
2009-11-02 04:37:17 +00:00
Chris Lattner
7e74831e52 only IPSCCP incoming arguments if the function is executable, this fixes
an assertion on the buildbot.

llvm-svn: 85784
2009-11-02 03:25:55 +00:00
Chris Lattner
0a8c553eb2 add a new ValueState::getConstantInt() helper, use it to
simplify some code.

llvm-svn: 85783
2009-11-02 03:21:36 +00:00
Chris Lattner
4372b58329 tidy up some more: remove some extraneous inline specifiers, return harder.
llvm-svn: 85780
2009-11-02 03:03:42 +00:00
Chris Lattner
1c8cb53667 eliminate the SCCPSolver::getValueMapping method.
llvm-svn: 85778
2009-11-02 02:54:24 +00:00
Chris Lattner
f02562df08 fix failures introduced in r85774
llvm-svn: 85777
2009-11-02 02:48:17 +00:00
Chris Lattner
d4f286cb0c factor duplicated code into a new DeleteInstructionInBlock
function, eliminate temporary (and pointless) smallvector.

llvm-svn: 85776
2009-11-02 02:47:51 +00:00
Chris Lattner
a806b18c99 Chris used to use '...' instead of proper grammar.
llvm-svn: 85775
2009-11-02 02:33:50 +00:00
Chris Lattner
37dc1cb0fb remove some extraneous llvmcontext stuff.
llvm-svn: 85774
2009-11-02 02:30:06 +00:00
Chris Lattner
28db47c45a change LatticeVal to use PointerIntPair to save some space.
llvm-svn: 85773
2009-11-02 02:20:32 +00:00
Chris Lattner
b94afb778c fix instcombine to only do store sinking when the alignments
of the two loads agree.  Propagate that onto the new store.

llvm-svn: 85772
2009-11-02 02:06:37 +00:00
Chris Lattner
f3c2039dde when merging two loads, make sure to take the min of their alignment,
not the max.  This didn't matter until the previous patch because
instcombine would refuse to sink loads with differenting alignments.

llvm-svn: 85738
2009-11-01 20:07:07 +00:00
Chris Lattner
e7b1e067e9 split load sinking out to its own function, like gep sinking.
llvm-svn: 85737
2009-11-01 20:04:24 +00:00
Chris Lattner
b3fe1009a5 fix a bug noticed by inspection: when instcombine sinks loads through
phis, it didn't preserve the alignment of the load.  This is a missed
optimization of the alignment is high and a miscompilation when the
alignment is low.

llvm-svn: 85736
2009-11-01 19:50:13 +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
Chris Lattner
ad2926bbb4 remove a bunch of locking from LLVMContextImpl. Since only one thread
can be banging on a context at a time, this isn't needed.  Owen, please
review.

llvm-svn: 85728
2009-11-01 18:42:03 +00:00
Chris Lattner
02e43b65d1 improve comment.
llvm-svn: 85725
2009-11-01 18:17:37 +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