<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jul 9, 2015 at 12:15 PM, Sanjoy Das <span dir="ltr"><<a href="mailto:sanjoy@playingwithpointers.com" target="_blank">sanjoy@playingwithpointers.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, Jul 8, 2015 at 6:01 PM, Bjarke Roune <<a href="mailto:broune@google.com">broune@google.com</a>> wrote:<br>
> There is PostDominatorTree for determining post-dominance. Even if A<br>
> post-dominates B and B is executed, that doesn't guarantee that A will be<br>
> executed. For example, there could be an infinite loop in-between. Strong<br>
> post-dominance makes the stronger guarantee that there will be no infinite<br>
> loop from B to A. Do we have anything in LLVM for determining strong<br>
> post-dominance and in general for guaranteeing that if B is executed, then A<br>
> will also be executed?<br>
<br>
</div></div>The closest thing to this I can think of is `isGuaranteedToExecute` in<br>
LICM.cpp.  Perhaps that mechanism can be generalized?<br>
<div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div>Thanks. I took a look at it. It does not appear to take into account nested infinite loops, yet it uses this function to hoist trapping instructions. I also don't think that it works correctly if the loop itself iterates infinitely but does have exit blocks in the CFG. I think this function is based on the assumption that all loops terminate, but I don't see where LICM checks that. I'm about to file a bug for that and see if I can trigger it in an example, but feel free to save me the effort if you know some reason that what it's doing is OK?</div><div><br></div><div>Bjarke</div></div></div></div>