[LLVMdev] Pass Added as Required fails assert

Devang Patel dpatel at apple.com
Thu Jul 17 15:05:30 PDT 2008


On Jul 17, 2008, at 2:54 PM, Thomas Mason wrote:

> We have discovered the issue with our code.  It seems that when the  
> first call to doInitilization utilized one of the specified  
> analyses, that analysis had never been properly added as required.   
> Using gdb, we can see that addRequired is getting called (seen  
> below) but when doInitalization is finally called, it still responds  
> as if the analysis was not required.
>
> Is this a bug or is doInitialization not permitted to access other  
> analyses?

Yes this is true. doInitialization() is used to prepare the stage and  
it is executed before any other pass is run by the pass manager.


If pass B requires pass A then usual sequence is

Run PassA doInitialization()
Run PassB doInitialization()   <--- Here PassA is not run so the  
analysis info. provided by A is not available.

Run PassA
Run PassB

Run PassA doFinalization()
Run PassB doFinalization()

-
Devang

> Our code functions correctly as a function pass as well as on any  
> program that has other functions prior to the main function.  It  
> only fails in this manner when main is the first (or only) function  
> in the source file.




More information about the llvm-dev mailing list