[Re: problem with multiple LLVM passes]

My reply button isn't working like it used to...
:slight_smile:

-- John T.

Re: [LLVMdev] problem with multiple LLVM passes.eml (2.46 KB)

Rakesh Komuravelli wrote:

Hi John,

I am having the exact same problem. Let me answer the four questions
that you have asked..

1) Are both passes included in the same dynamic library? If not, are
you loading their respective libraries with multiple -load options?

Yes. I load both the libraries with two -load options. I see both the
passes listed when run opt with --help flag

Okay. This means that both passes are loading successfully.

2) Do both passes have a static <Passname>::ID variable defined in their
respective .cpp files?

Yes. I also tried initializing them with different values.

Just to be paranoid: each pass is using its own ID varibles, correct?

3) Is LiveVars an analysis pass? Does it say that it preserves all
other passes in its getAnalysisUsage() method? If not, you could have a
dependency chain that never gets resolved.

I inserted AU.setPreservesAll() in getAnalysisUsage of the first pass

I assume the first pass is an analysis pass that call
AU.setPreservesAll(), and the second pass is a transform pass that
preserves nothing. Is this correct?

4) Does opt print any error messages when loading the dynamic
library/libraries implementing your two passes?

opt prints the following error message:

opt: /home/sadve/komurav1/llvm/include/llvm/PassAnalysisSupport.h:53:
llvm::AnalysisUsage& llvm::AnalysisUsage::addRequiredID(const
llvm::PassInfo*): Assertion `ID && "Pass class not registered!"' failed.

Any insight on what might be going wrong?

So, my purpose in asking the above questions was to eliminate several
possible causes. It looks like your passes are loading properly. I am
assuming that each pass is using a separate ID variable, so that
shouldn't the problem either.

My only guess at this point is that it may be possible for there to be
an unsolvable dependency in your passes. An example of this can occur
when a transform pass doubles as an analysis pass: if the transform pass
T invalidates an analysis pass A, and then another pass P requires both
T and A, the pass manager hits a similar assertion because it can't
schedule both T and A such that they are available simultaneously for
pass P.

A quick test to see if this is the problem is to make the transform pass
preserve all other passes and then try running both the analysis pass
and the transform pass. If it works, then there's a scheduling
dependency problem.

I'm forwarding this email to llvmdev in hopes that someone else has
other ideas on how to debug this problem without diving into the pass
manager internals. I can help you with that if necessary (I've done it
before), but I'd like to avoid it if possible.

-- John T.