[PATCH] [OPENMP] llvm.loop.vectorize.enable metadata are lost after critical edge splitting

Andrew Trick atrick at apple.com
Tue Sep 30 18:43:14 PDT 2014

> On Sep 30, 2014, at 4:02 PM, Johannes Doerfert <doerfert at cs.uni-saarland.de> wrote:
>> In splitCriticalEdges, if LoopInfo is available you can use it. Otherwise you can use the DomTree. If the DomTree check fails (ie. both targets dominate the latch) then just invalidate the metadata.
> I could update my patch if we decide to go this way. It would probably require the least change outside the actual SplitCriticalEdge function.

It would be nice to add logic to SplitCritical edge to handle the situation where we have a DomTree but no LoopInfo. That way GVN does not need to require LoopInfo. But it may be a little tricky.

Instead of directly checking for a loop header, you would be checking whether the branch target dominates the branch block. Unfortunately, you’ll have trouble with nested loops. You would have to check both targets of the loop exit block. If only one dominates the exit block it’s easy. If both dominate the exit block then one will dominate the other, with the latter being the current inner loop. Note that this is not a general way to find the current loop header, but should work in the case of splitting a single critical edge where we know that the loop exit block was formerly the loop latch (i.e. it MUST branch directly to the loop header before splitting).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140930/bed6c6c5/attachment.html>

More information about the llvm-commits mailing list