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

51233 Commits

Author SHA1 Message Date
Torok Edwin
097a206969 Free the constants that have no uses in ~LLVMContext.
This fixes leaks from LLVMContext in multithreaded apps.
Since constants are only deleted if they have no uses, it is safe to not delete
a Module on shutdown, as many single-threaded tools do.
Multithreaded apps should however delete the Module before destroying the
Context to ensure that there are no leaks (assuming they use a different context
for each thread).

llvm-svn: 80590
2009-08-31 16:14:59 +00:00
Torok Edwin
fbeacd1ab7 Fix ExplicitSymbols leak.
llvm-svn: 80589
2009-08-31 16:12:29 +00:00
Benjamin Kramer
61232721d9 Normalize makefile comments and sort cmake file lists.
llvm-svn: 80584
2009-08-31 13:05:24 +00:00
Daniel Dunbar
3a44b6da61 llvm-mc: Pass values to MCStreamer as MCExprs, not MCValues.
llvm-svn: 80578
2009-08-31 08:09:28 +00:00
Daniel Dunbar
b897e807c4 llvm-mc: Simplify EmitAssignment ('.set' is identical to '=').
llvm-svn: 80577
2009-08-31 08:09:09 +00:00
Daniel Dunbar
11035eeb11 llvm-mc: Remove MCAsmParser::Parse[Paren]RelocatableExpression.
llvm-svn: 80576
2009-08-31 08:08:50 +00:00
Daniel Dunbar
fcb32716eb llvm-mc: Switch MCInst to storing an MCExpr* instead of an MCValue.
Also, use MCInst::print instead of custom code in MCAsmPrinter.

llvm-svn: 80575
2009-08-31 08:08:38 +00:00
Daniel Dunbar
5fbaad8079 llvm-mc: Add MCAsmParser::Parse[Paren]Expression forms which return an MCExpr.
llvm-svn: 80574
2009-08-31 08:08:17 +00:00
Daniel Dunbar
be245a258c llvm-mc: Make MCSymbolData symbol member const.
llvm-svn: 80573
2009-08-31 08:08:06 +00:00
Daniel Dunbar
1689464a71 llvm-mc: Add MCContext to MCAssembler.
llvm-svn: 80572
2009-08-31 08:07:55 +00:00
Daniel Dunbar
22505125c8 llvm-mc: Add MCAsmParser::getContext.
llvm-svn: 80571
2009-08-31 08:07:44 +00:00
Daniel Dunbar
4e5556dbd1 llvm-mc: Add MCExpr::{dump,print}.
llvm-svn: 80570
2009-08-31 08:07:33 +00:00
Daniel Dunbar
053a5f22a0 llvm-mc: Switch MCExpr construction to using static member functions, and taking the MCContext (which now owns all MCExprs).
llvm-svn: 80569
2009-08-31 08:07:22 +00:00
Daniel Dunbar
fb42aebc4f llvm-mc: Add some doxyment markers.
llvm-svn: 80568
2009-08-31 08:07:08 +00:00
Daniel Dunbar
b882c70ff2 llvm-mc: Move AsmExpr into MC lib (as MCExpr).
llvm-svn: 80567
2009-08-31 08:06:59 +00:00
Chris Lattner
acdb45e484 Step #1 to giving Callgraph some sane invariants. The problems with callgraph
stem from the fact that we have two types of passes that need to update it:

1. callgraphscc and module passes that are explicitly aware of it
2. Functionpasses (and loop passes etc) that are interlaced with CGSCC passes
   by the CGSCC Passmgr.

In the case of #1, we can reasonably expect the passes to update the call
graph just like any analysis.  However, functionpasses are not and generally
should not be CG aware.  This has caused us no end of problems, so this takes
a new approach.  Logically, the CGSCC Pass manager can rescan every function 
after it runs a function pass over it to see if the functionpass made any 
updates to the IR that affect the callgraph.  This allows it to catch new calls
introduced by the functionpass.

In practice, doing this would be slow.  This implementation keeps track of
whether or not the current scc is dirtied by a function pass, and, if so, 
delays updating the callgraph until it is actually needed again.  This was
we avoid extraneous rescans, but we still have good invariants when the
callgraph is needed.

Step #2 of the "give Callgraph some sane invariants" is to change CallGraphNode
to use a CallBackVH for the callsite entry of the CallGraphNode.  This way
we can immediately remove entries from the callgraph when a FunctionPass is
active instead of having dangling pointers.  The current pass tries to tolerate
these dangling pointers, but it is just an evil hack.

This is related to PR3601/4835/4029.  This also reverts r80541, a hack working
around the sad lack of invariants.

llvm-svn: 80566
2009-08-31 07:23:46 +00:00
Chris Lattner
72a767d05f fix some cases where instcombine would change hte IR but not return true
from runOnFunction

llvm-svn: 80562
2009-08-31 06:57:37 +00:00
Chris Lattner
36e941a542 cleanups, factor some code out to a helper function
llvm-svn: 80542
2009-08-31 06:01:21 +00:00
Chris Lattner
368df2bb6f fix a crash building SPASS by tolerating a callsite that doesn't exist
in the callgraph, see the big comment at the top of the testcase.

llvm-svn: 80541
2009-08-31 05:46:59 +00:00
Chris Lattner
ca6ef3aa56 comment and simplify some code.
llvm-svn: 80540
2009-08-31 05:34:32 +00:00
Chris Lattner
09db62ac23 add -debug output
llvm-svn: 80539
2009-08-31 05:22:48 +00:00
Chris Lattner
bec75e8582 improve -debug output, so that -debug is more likely to print when
instcombine is changing stuff.

llvm-svn: 80538
2009-08-31 05:17:58 +00:00
Chris Lattner
73d1e17cec fix a bug I introduced with my 'instcombine builder' refactoring
changes: SimplifyDemandedBits can't use the builder yet because it
has the wrong insertion point.  This fixes a crash building
MultiSource/Benchmarks/PAQ8p

llvm-svn: 80537
2009-08-31 04:36:22 +00:00
Chris Lattner
b045a7f27b simplify some code by making the SCCNodes set contain Function*'s
instead of CallGraphNode*'s.  This also papers over a callgraph
problem where a pass (in this case, MemCpyOpt) introduces a new
function into the module (llvm.memset.i64) but doesn't add it to
the call graph (nor should it, since it is a function pass).

While it might be a good idea for MemCpyOpt to not synthesize 
functions in a runOnFunction(), there is no need for FunctionAttrs
to be boneheaded, so fix it there.  This fixes an assertion building
176.gcc.

llvm-svn: 80535
2009-08-31 04:09:04 +00:00
Chris Lattner
2081eaa21d only print the override triple if it exists!
llvm-svn: 80534
2009-08-31 03:22:35 +00:00
Chris Lattner
5eec095b87 Fix PR4834, a tricky case where the inliner would resolve an
indirect function pointer, inline it, then go to delete the body.
The problem is that the callgraph had other references to the function,
though the inliner had no way to know it, so we got a dangling pointer
and an invalid iterator out of the deal.

The fix to this is pretty simple: stop the inliner from deleting the
function by knowing that there are references to it.  Do this by making
CallGraphNodes contain a refcount.  This requires moving deletion of 
available_externally functions to the module-level cleanup sweep where
it belongs.

llvm-svn: 80533
2009-08-31 03:15:49 +00:00
Chris Lattner
c1501183f3 use an accessor instead of poking internals of a node.
llvm-svn: 80532
2009-08-31 02:24:20 +00:00
Oscar Fuentes
03ef83d429 CMake: updated library dependencies.
llvm-svn: 80531
2009-08-31 01:58:50 +00:00
Jim Grosbach
a09b5ac346 PR4747
Shared landing pads run into trouble with SJLJ, as the dispatch table is
mapped to call sites, and merging the pads will throw that off. There needs
to be a one-to-one mapping of landing pad exception table entries to invoke
call points.

Detecting the shared pad during lowering of SJLJ info insn't sufficient, as
the dispatch function may still need separate destinations to properly
handle phi-nodes.

llvm-svn: 80530
2009-08-31 01:35:03 +00:00
Chris Lattner
993712b47e update unit test for previous change.
llvm-svn: 80528
2009-08-31 00:28:46 +00:00
Chris Lattner
085c521fe2 Fix some nasty callgraph dangling pointer problems in
argpromotion and structretpromote.  Basically, when replacing
a function, they used the 'changeFunction' api which changes
the entry in the function map (and steals/reuses the callgraph
node).

This has some interesting effects: first, the problem is that it doesn't
update the "callee" edges in any callees of the function in the call graph.
Second, this covers for a major problem in all the CGSCC pass stuff, which 
is that it is completely broken when functions are deleted if they *don't*
reuse a CGN.  (there is a cute little fixme about this though :).

This patch changes the protocol that CGSCC passes must obey: now the CGSCC 
pass manager copies the SCC and preincrements its iterator to avoid passes
invalidating it.  This allows CGSCC passes to mutate the current SCC.  However
multiple passes may be run on that SCC, so if passes do this, they are now
required to *update* the SCC to be current when they return.

Other less interesting parts of this patch are that it makes passes update
the CG more directly, eliminates changeFunction, and requires clients of
replaceCallSite to specify the new callee CGN if they are changing it.

llvm-svn: 80527
2009-08-31 00:19:58 +00:00
Erick Tryzelaar
af1b2037d3 Fix header comment for bindings/ocaml/llvm/Makefile.
llvm-svn: 80526
2009-08-30 23:41:20 +00:00
Erick Tryzelaar
5d79f870eb Make sure we specify no arguments for context functions.
llvm-svn: 80525
2009-08-30 23:38:06 +00:00
Chris Lattner
ab05dcb602 add a dump() method on callgraph.
llvm-svn: 80524
2009-08-30 22:24:32 +00:00
Chris Lattner
bfb4e6a9d3 rename test
llvm-svn: 80523
2009-08-30 22:14:17 +00:00
Chris Lattner
31fd178e21 merge all sinking tests into one and convert them to filecheck.
llvm-svn: 80522
2009-08-30 22:13:26 +00:00
Chris Lattner
0715defcef convert scalar_promote to filecheck style and merge 2003-12-13-VolatilePromote.ll into it.
llvm-svn: 80521
2009-08-30 22:08:19 +00:00
Chris Lattner
f32c2d890c eliminate some uses of prcontext. Any help here would be appreciated :)
llvm-svn: 80520
2009-08-30 21:45:23 +00:00
Chris Lattner
4c06cf3a4f rename test so that name reflects what it is testing for.
llvm-svn: 80519
2009-08-30 21:36:39 +00:00
Chris Lattner
0ad4b1ca5e convert to filecheck format.
llvm-svn: 80518
2009-08-30 21:36:06 +00:00
Chris Lattner
1c81f120e2 suck a bunch more gep tests into getelementptr.ll and filecheckize them all.
llvm-svn: 80517
2009-08-30 21:31:34 +00:00
Daniel Dunbar
30b720266e Tweak comment.
llvm-svn: 80516
2009-08-30 21:14:05 +00:00
Daniel Dunbar
89f43b31cc Fix some possible-use-of-uninitialized warnings.
llvm-svn: 80515
2009-08-30 21:13:58 +00:00
Chris Lattner
1c8bd32732 consolodate various GEP tests into getelementptr.ll using filecheck.
llvm-svn: 80514
2009-08-30 21:02:36 +00:00
Chris Lattner
ac17c19a06 another huge testcase, this time from 'gs' in llvm-test.
llvm-svn: 80513
2009-08-30 21:02:02 +00:00
Chris Lattner
6c6cd82568 remove another poorly-reduced testcase which came from ldecod in llvm-test.
llvm-svn: 80512
2009-08-30 21:01:14 +00:00
Chris Lattner
94ea2fb674 this testcase is 500 lines long and is distilled from bzip2, just
remove it.

llvm-svn: 80511
2009-08-30 21:00:11 +00:00
Chris Lattner
22c8be162d convert to filecheck
llvm-svn: 80510
2009-08-30 20:48:15 +00:00
Chris Lattner
d21a94f8d6 Fix PR4748: don't fold gep(bitcast(x)) into bitcast(gep) when x
is itself a bitcast.  Since we have gep(bitcast(bitcast(y))) in this
case, just wait for the two bitcasts to get zapped.  This prevents
instcombine from confusing some aliasing stuff, and allows it to
directly eliminate the load in the testcase.

llvm-svn: 80508
2009-08-30 20:38:21 +00:00
Chris Lattner
474990915a misc cleanup
llvm-svn: 80507
2009-08-30 20:36:46 +00:00