Commit Graph

92 Commits

Author SHA1 Message Date
Nuno Lopes 674acc12d0 RefreshCallGraph: ignore 'invoke intrinsic'. IntrinsicInst doesnt not recognize invoke, and shouldnt at this point, since the rest of LLVM codebase doesnt expect invoke of intrinsics
llvm-svn: 159441
2012-06-29 17:49:32 +00:00
Andrew Trick 0896621a50 Reapply r138695. Fix PassManager stack depths.
Patch by Xiaoyi Guo!

llvm-svn: 138737
2011-08-29 17:07:00 +00:00
Andrew Trick 5c29ebae8e Reverting r138695 to see if it fixes clang self host.
llvm-svn: 138701
2011-08-27 06:10:16 +00:00
Andrew Trick b0cd1e65de Fix PassManager stack depths.
Patch by Xiaoyi Guo!

llvm-svn: 138695
2011-08-27 02:11:03 +00:00
Duncan Sands a41634e307 Silence a bunch (but not all) "variable written but not read" warnings
when building with assertions disabled.

llvm-svn: 137460
2011-08-12 14:54:45 +00:00
John McCall 729c35b680 Teach the CallGraph to ignore calls to intrinsics.
llvm-svn: 132797
2011-06-09 19:46:27 +00:00
Chris Lattner 0963048185 dead method.
llvm-svn: 113077
2010-09-04 18:19:16 +00:00
Dan Gohman f71c521fb7 Revert r111199; it breaks -debug-pass=Structure output.
llvm-svn: 111500
2010-08-19 01:29:07 +00:00
Dan Gohman 55cd6aadc9 Make dumpPassStructure be a PMDataManager abstraction, rather than
a Pass abstraction, since that's the level it's actually used at.
Rename Pass' dumpPassStructure to dumpPass.

This eliminates an awkward use of getAsPass() to convert a PMDataManager*
into a Pass* just to permit a dumpPassStructure call.

llvm-svn: 111199
2010-08-16 22:45:12 +00:00
Owen Anderson a7aed18624 Reapply r110396, with fixes to appease the Linux buildbot gods.
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson bda59bd247 Revert r110396 to fix buildbots.
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson 755aceb5d0 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.

llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Gabor Greif 5bf74d648d use Value* constructor of CallSite to create potentially improper site, and test that
llvm-svn: 109580
2010-07-28 12:35:54 +00:00
Chris Lattner 532112b98a fix PR5009 by making CGSCCPM realize that a call was devirtualized
if an indirect call site was removed and a direct one was added, not
just if an indirect call site was modified to be direct.

llvm-svn: 102830
2010-05-01 06:38:43 +00:00
Chris Lattner fc8d9ee6c3 Implement rdar://6295824 and PR6724 with two tiny changes
that can have a big effect :).  The first is to enable the
iterative SCC passmanager juice that kicks in when the
scc passmgr detects that a function pass has devirtualized
a call.  In this case, it will rerun all the passes it 
manages on the SCC, up to the iteration count limit (4). This
is useful because a function pass may devirualize a call, and
we want the inliner to inline it, or pruneeh to infer stuff
about it, etc.

The second patch is to add *all* call sites to the 
DevirtualizedCalls list the inliner uses.  This list is
about to get renamed, but the jist of this is that the 
inliner now reconsiders *all* inlined call sites as candidates
for further inlining.  The intuition is this that in cases 
like this:

f() { g(1); }     g(int x) { h(x); }

We analyze this bottom up, and may decide that it isn't 
profitable to inline H into G.  Next step, we decide that it is
profitable to inline G into F, and do so, which means that F 
now calls H.  Even though the call from G -> H may not have been
profitable to inline, the call from F -> H may be (in this case
because a constant allows folding etc).

In my spot checks, this doesn't have a big impact on code.  For
example, the LLC output for 252.eon grew from 0.02% (from
317252 to 317308) and 176.gcc actually shrunk by .3% (from 1525612
to 1520964 bytes).  252.eon never iterated in the SCC Passmgr,
176.gcc iterated at most 1 time.

llvm-svn: 102823
2010-05-01 01:15:56 +00:00
Chris Lattner 055cf267db add a DEBUG call so that -debug lists when CGSCCPM iterates.
Fix RefreshCallGraph to use CGN->replaceCallEdge instead of hand
rolling its own loop.  replaceCallEdge properly maintains the
reference counts of the nodes, fixing a crash exposed by the
iterative callgraph stuff.

llvm-svn: 102120
2010-04-22 20:42:33 +00:00
Chris Lattner 6fbe704932 Implement (but don't enable) PR6724 and rdar://6295824. In short,
we have RefreshCallGraph detect when a function pass devirtualizes
a call, and have CGSCCPassMgr iterate (up to a count) when this 
happens.  This allows (in the example) GVN to devirtualize the 
call in foo, then the inliner to inline it away.

This is not currently enabled because I haven't done any analysis
on the (potentially substantial) code size or performance impact of
doing this, and guess what, it exposes callgraph updating bugs in
various passes.  This is progress though, and you can play with it
by passing -max-cg-scc-iterations=5 to opt.

llvm-svn: 101973
2010-04-21 00:47:40 +00:00
Chris Lattner 7c4f14bf90 reenable r101565, removing a problematic assertion.
CGSCC can delete nodes in regions of the callgraph that
have already been visited.  If new CG nodes are allocated
to the same pointer, we shouldn't abort, just handle it
correctly by assigning a new number.  This should restore
stability by removing invalidated pointers that *will* be
reused from the densemap in the iterator.

llvm-svn: 101628
2010-04-17 07:17:19 +00:00
Chris Lattner dddbcba270 disable r101565: an assert is getting triggered. More lurking badness no doubt.
llvm-svn: 101583
2010-04-17 00:05:36 +00:00
Chris Lattner de023a3c1d building on the new CallGraphSCC abstraction, teach CallGraphSCCPassManager
to keep the node entries in scc_iterator up to date instead of dangling as
the SCC mutates.

This is a really terrible problem which was causing -g to affect codegen 
because it would permute the memory image of the compiler process.

Thanks to Dale for expertly hunting it down.

llvm-svn: 101565
2010-04-16 23:04:30 +00:00
Chris Lattner 5518b81a98 move ReplaceNode out of line, rename scc_iterator::fini -> isAtEnd().
No functionality change.

llvm-svn: 101562
2010-04-16 22:59:24 +00:00
Chris Lattner 4422d31b84 introduce a new CallGraphSCC class, and pass it around
to CallGraphSCCPass's instead of passing around a
std::vector<CallGraphNode*>.  No functionality change,
but now we have a much tidier interface.

llvm-svn: 101558
2010-04-16 22:42:17 +00:00
Chris Lattner 6d1208fd2b move PrintCallGraphPass out of the middle of CGPassManager.
llvm-svn: 101543
2010-04-16 21:43:55 +00:00
David Greene 9b063df40b Ok, third time's the charm. No changes from last time except the CMake
source addition.  Apparently the buildbots were wrong about failures.

---

Add some switches helpful for debugging:

-print-before=<Pass Name>

Dump IR before running pass <Pass Name>.

-print-before-all

Dump IR before running each pass.

-print-after-all

Dump IR after running each pass.

These are helpful when tracking down a miscompilation.  It is easy to
get IR dumps and do diffs on them, etc.

To make this work well, add a new getPrinterPass API to Pass so that
each kind of pass (ModulePass, FunctionPass, etc.) can create a Pass
suitable for dumping out the kind of object the Pass works on.

llvm-svn: 100249
2010-04-02 23:17:14 +00:00
Evan Cheng 389525bdea Revert 100204. It broke a bunch of tests and apparently changed what passes are run during codegen.
llvm-svn: 100207
2010-04-02 19:29:15 +00:00
David Greene 8f32cb9fce Let's try this again. Re-apply 100143 including an apparent missing
<string> include.  For some reason the buildbot choked on this while my
builds did not.  It's probably due to a difference in system headers.

---

Add some switches helpful for debugging:

-print-before=<Pass Name>

Dump IR before running pass <Pass Name>.

-print-before-all

Dump IR before running each pass.

-print-after-all

Dump IR after running each pass.

These are helpful when tracking down a miscompilation.  It is easy to
get IR dumps and do diffs on them, etc.

To make this work well, add a new getPrinterPass API to Pass so that
each kind of pass (ModulePass, FunctionPass, etc.) can create a Pass
suitable for dumping out the kind of object the Pass works on.

llvm-svn: 100204
2010-04-02 18:46:26 +00:00
Eric Christopher 5342ddaadf Revert r100143.
llvm-svn: 100146
2010-04-01 22:54:42 +00:00
David Greene 6789e21094 Add some switches helpful for debugging:
-print-before=<Pass Name>

Dump IR before running pass <Pass Name>.

-print-before-all

Dump IR before running each pass.

-print-after-all

Dump IR after running each pass.

These are helpful when tracking down a miscompilation.  It is easy to
get IR dumps and do diffs on them, etc.

To make this work well, add a new getPrinterPass API to Pass so that
each kind of pass (ModulePass, FunctionPass, etc.) can create a Pass
suitable for dumping out the kind of object the Pass works on.

llvm-svn: 100143
2010-04-01 22:43:57 +00:00
Chris Lattner 707431cf26 reapply my timer rewrite with a change for PassManager to store
timers by pointer instead of by-value.

llvm-svn: 99871
2010-03-30 04:03:22 +00:00
Chris Lattner ec8ef9b643 revert r99862 which is causing FNT failures.
llvm-svn: 99870
2010-03-30 03:57:00 +00:00
Chris Lattner 57a0542397 fairly major rewrite of various timing related stuff.
llvm-svn: 99862
2010-03-30 02:38:19 +00:00
Chris Lattner 0b1c7235aa eliminate dynamic_cast from this file.
llvm-svn: 94157
2010-01-22 05:46:59 +00:00
Chris Lattner 9efd4fcceb eliminate a bunch more unneeded dynamic_cast's.
llvm-svn: 94156
2010-01-22 05:37:10 +00:00
Chris Lattner 2fa26e5fd0 eliminate a bunch of dynamic_cast's.
llvm-svn: 94155
2010-01-22 05:24:46 +00:00
David Greene 3d64631fef Change dbgs() back to errs() for assert messages as Chris requested.
llvm-svn: 92080
2009-12-23 23:09:39 +00:00
David Greene f8ed991e5a Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92035
2009-12-23 20:10:59 +00:00
Dan Gohman 277e767578 Extend the StartPassTimer and StopPassTimer functions so that the
code that stops the timer doesn't have to search to find the timer
object before it stops the timer. This avoids a lock acquisition
and a few other things done with the timer running.

llvm-svn: 82949
2009-09-28 00:07:05 +00:00
Chris Lattner d4d966f500 make -debug-pass=Executions show information about what call graph nodes
are in the SCC for each execution of a CGSCC pass.

llvm-svn: 81838
2009-09-15 05:03:04 +00:00
Dale Johannesen 50f0376f49 Fix uppercaseo.
llvm-svn: 81463
2009-09-10 22:01:32 +00:00
Chris Lattner 65fb597793 revert my patch, duncan points out what is wrong with my logic. Add
a comment so that I don't change this in the future :)

llvm-svn: 80760
2009-09-02 04:39:04 +00:00
Chris Lattner 8f23276431 one more try at making this simpler, hopefully it won't break everything :)
llvm-svn: 80759
2009-09-02 04:34:06 +00:00
Duncan Sands 5632d96176 Complicate Chris's simplification, avoiding complaints
about singular iterators when building with expensive
checks turned on.

llvm-svn: 80757
2009-09-02 03:48:41 +00:00
Chris Lattner 6190bb01be debug intrinsics do not go in the callgraph, this fixes a couple
clang regtest failures.

llvm-svn: 80724
2009-09-01 21:37:50 +00:00
Chris Lattner 339c82df85 Fix a regression I introduced in r80708, found by llvm-test.
llvm-svn: 80718
2009-09-01 20:33:43 +00:00
Chris Lattner 9b463729d7 remove CallGraphNode::replaceCallSite, it is redundant with other APIs.
llvm-svn: 80708
2009-09-01 18:52:39 +00:00
Chris Lattner e33167ac35 doxygenate RefreshCallGraph, add a new 'verification mode', and run it after
CGSCC passes make change to ensure they are updating the callgraph correctly
(when assertions are enabled).

llvm-svn: 80698
2009-09-01 18:32:03 +00:00
Chris Lattner 3f7b3d149f simpler solution to iterator invalidation "problem" found
by expensive checking.

llvm-svn: 80695
2009-09-01 18:13:40 +00:00
Duncan Sands 1f8303bfce Do not manipulate invalid iterators. This fixes the
llvm-gcc build when expensive checking is turned on.

llvm-svn: 80671
2009-09-01 15:13:02 +00:00
Chris Lattner 063d06527e Change CallGraphNode to maintain it's Function as an AssertingVH
for sanity.  This didn't turn up any bugs.

Change CallGraphNode to maintain its "callsite" information in the 
call edges list as a WeakVH instead of as an instruction*.  This fixes
a broad class of dangling pointer bugs, and makes CallGraph have a number
of useful invariants again.  This fixes the class of problem indicated
by PR4029 and PR3601.

llvm-svn: 80663
2009-09-01 06:31:31 +00:00
Chris Lattner a9262bb19c cleanups pointed out by duncan
llvm-svn: 80595
2009-08-31 17:08:30 +00:00