Okay thanks for the info.  The term program termination was probably a poor choice of words.  I'm really just trying to build an inter-procedural BasicBlock graph, and then look for postdominance as Scott suggested.  I'll go about making my own since it doesn't sound like there is one out there already.<div>
<br></div><div>Thanks,</div><div>-Stephen<div><div><br><div class="gmail_quote">On Tue, Oct 2, 2012 at 5:06 PM, Scott Moore <span dir="ltr"><<a href="mailto:sdmoore@fas.harvard.edu" target="_blank">sdmoore@fas.harvard.edu</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>I think you're looking for an inter-procedural post dominator analysis. I don't think there is one in LLVM already, but it should be relatively straightforward.</div>

<div><br></div><div>This gives a sound approximation (i.e. no false positives) of something sort-of equivalent to the halting problem: if the program terminates, then block Y was executed.</div>
<div><br></div>Cheers,<br>Scott<div><div><br>
<br><br><div class="gmail_quote">On Tue, Oct 2, 2012 at 7:43 PM, Jim Grosbach <span dir="ltr"><<a href="mailto:grosbach@apple.com" target="_blank">grosbach@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div style="word-wrap:break-word">Isn't this effectively the halting problem? Consider the case where block Y is the exit block of main() and block X is the entry block of main().<div><br></div><div>Jim<br><div><br></div>


<div><br><div><div><div>On Oct 2, 2012, at 4:29 PM, Stephen Schiffli <<a href="mailto:sschiffli@gmail.com" target="_blank">sschiffli@gmail.com</a>> wrote:</div></div><div><br><blockquote type="cite"><div>
<div><p class="MsoNormal">Is there any inter-procedural analysis that could tell me if
some BasicBlock Y is guaranteed to execute based on my knowledge that
BasicBlock X will execute?  For example:</p><p class="MsoNormal"><br></p><p class="MsoNormal">extern int x;</p><p class="MsoNormal">void foo() { }</p><p class="MsoNormal">int main() {</p><p class="MsoNormal">            if (x) {</p>


<p class="MsoNormal">                        foo();</p><p class="MsoNormal">            } else {</p><p class="MsoNormal">                        foo();</p><p class="MsoNormal" style="text-indent:.5in">}</p><p class="MsoNormal">


}</p><div> <br></div><p class="MsoNormal">I want to be told that the entry block of foo is guaranteed
to be executed since I know the entry block of main is guaranteed to be
executed.  Basically that all paths from X to program termination go through Y at some point.  Please ignore the folding of identical branches and function in-lining, I want to use this type of analysis in the general case.</p>


<p class="MsoNormal"><br></p><p class="MsoNormal">Thanks,</p><p class="MsoNormal">-Stephen</p></div></div>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>


<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br></div></div></div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br>
</div></div></blockquote></div><br>
</div></div></div>