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

Johannes Doerfert doerfert at cs.uni-saarland.de
Tue Sep 30 14:13:38 PDT 2014


>>! In D5539#13, @atrick wrote:
> If the problem here is that GVN is dropping the loop.vectortize metadata, adding LoopInfo as a required pass seems fundamentally wrong. Critical edge splitting is supposed to be something any pass can do on-the-fly without extra analysis. Of course, the whole problem would have been simpler if we just required annotated loops to have split edges to begin with, but that issue is out-of-scope for this bug.
GVN (and other transformations) use the static SplitCiticalEdge function instead of the BreakCriticalEdges pass. This function does rely on the Pass * argument to get LoopInfo and the DomTreeWrapperPass to update information. However, loop metadata isn't considered so far. Both patches try to fix that issue.

> I have some basic questions:
> 
> - I haven't been paying close attention to the loop.vectorize metadata design. Why does it need to be on the loop backedge branch? It doesn't seem hard to discover the metadata on the last conditional branch leading to the backedge.
I cannot help you here, I don't know why it is designed like this.
 
> - Even if you do need to move the metadata to a different branch, why is LoopInfo required? Is it because we can't tell if we're splitting the backedge or the loop exit? DomTree would often be sufficient to tell them apart.
Even if we would rely on the DomTree instead of the LoopInfo we have the same problems.
  1) Either musst be available over the Pass * argument of SplitCriticalEdges
  2) The SplitCriticlEdges need to be patched to use the available pass in order to preserve the loop metadata.
  3) We need to invalidate the metadata instead of making it invalid.

http://reviews.llvm.org/D5539






More information about the llvm-commits mailing list