"Rotate Loop" pass kills "llvm.vectorizer.enable" metadata

Hi.

I faced that “llvm.vectorizer.enable” metadata used by Loop Vectorizer and set by OpenMP pragmas are killed after the “Rotate Loop” pass. The branch containing the metadata is replaced with another one, but without any metadata.
So “Loop Vectorizer” doesn’t force vectorization of this loop.

I can fix it of course by propagating the metadata to the new branch from the old one, but there’s no guarantee that some other pass will not kill at again.

May be we need more reliable way for setting metadata for such cases?

  • Zinovy.

From: "Zinovy Nis" <zinovy.nis@gmail.com>
To: llvmdev@cs.uiuc.edu
Sent: Monday, April 7, 2014 8:13:34 AM
Subject: [LLVMdev] "Rotate Loop" pass kills "llvm.vectorizer.enable" metadata

Hi.

I faced that " llvm.vectorizer.enable" metadata used by Loop
Vectorizer and set by OpenMP pragmas are killed after the "Rotate
Loop" pass. The branch containing the metadata is replaced with
another one, but without any metadata.
So "Loop Vectorizer" doesn't force vectorization of this loop.

I can fix it of course by propagating the metadata to the new branch
from the old one, but there's no guarantee that some other pass will
not kill at again.

May be we need more reliable way for setting metadata for such cases?

No, I think that updating the metadata in the pass is the right solution. The idea behind metadata is that passes that affect instructions, but don't explicitly understand the metadata, should drop the metadata. That is what insures semantic correctness.

That having been said, in this case, are you pointing out that, generally, passes that replace the loop backedge should not drop the loop id metadata? Generally, I agree, but I'm not sure there is a lot of code-level generalization here. That having been said, if there is some way that the LoopInfo can take care of this automatically in a way that will always be correct, that sounds good too.

-Hal