Breaking cyclic pass dependency by invalidating analysis results?


I am working on a modification to the AliasAnalysis’s getModRefInfo functions to use extended data race free regions to disambiguate memory interatctions between instructions in parallell programs.

The main problem is that my modified getModRefInfo functions are using a pass I have written that constructs information and provides an interface through a data-object.

This means that the AliasAnalysis pass requires my pass which requires another pass that requires AliasAnalysis. This creates a cyclic dependency that makes the use of the “getAnalysis():” function unusable as the pass manager cannot schedule my pass because of this.

I have tried using the “getAnalysisIfAvailable();” function instead in order to let AliasAnalysis run once without using the extensions I have made by checking if the result of this function i.e. the “MyPass object*” equals to NULL, and then run my Pass. What I would like is for my pass to trigger a re-run of AliasAnalysis and the transformation passes that depend on it like dead code elimination for example (dce).

My questions are as follows:

Does getAnalysisIfAvailable() return a non-null pointer if the pass has been run or if the pass is running and waiting for results concurrently with the other passes?

Can I even achieve this behaviour by invalidating AliasAnalysis somehow without modifying any other passes? (This would be the worst case as my project is focused on the AliasAnalysis pass and I would not like to break the LLVM modularity between individual passes)

/Nils Björk