Brian pointed out that the Olden/mst benchmark has code that basically looks like this: main() { Do_all_BlueRule(..., 1, 0); } void Do_all_BlueRule(..., int nproc, int pn) { if (nproc > 1) { Do_all_BlueRule(nproc/2, nproc/2+pn); ... A BUNCH OF OTHER STUFF ... } bar(); } The observation is that Do_all_BlueRule contains a bunch of code that is dynamically dead, but it requires a smarter IPCP algorithm to notice it (the unreachable recursive call causes us to miss this). It seems like an aggressive IPCP coupled with SCCP'y techniques could solve this pretty easily. -Chris
There are some notes for this bug here: http://nondot.org/sabre/LLVMNotes/IP-SCCP.txt -Chris
Here's a trivial testcase this should handle: implementation ; Functions: internal int %foo(int %X) { %Y = call int %foo( int %X ) ; <int> [#uses=1] %Z = add int %Y, 1 ; <int> [#uses=1] ret int %Z } void %bar() { call int %foo( int 17 ) ; <int>:0 [#uses=0] ret void } IPCP should realize that %X is always '17'. The current, simple IPCP, should detect and handle this too. I wish it already did, it would help pool allocation. :( -Chris
ok, another note. Simple IPCP now handles the simple case above.
Initial implementation: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041206/022044.html There is more to come for this PR, stay tuned! -Chris
This is now implemented, named -ipsccp. -Chris