Running Scalar Evolution on Modules on an ad-hoc basis


I am attempting to write a program which can analyze multiple llvm
modules. Specifically, I want to use scalar evolution on different
modules while being able to refer to the results across all modules thus

Ideally I don’t want to do it as an LTO pass – I don’t know which modules
I need to check at the time the program starts running.

My current attempt at an MVP is attached. However, it segfaults on line
41. My suspicion is that the prerequisite passes that ScalarEvolution
relies on aren’t being run, but I could be entirely mistaken on this.
Can anyone give me a pointer toward how to do this correctly?

Thank you!


stack_trace (3.73 KB)

multi_module_pass.cpp (1.17 KB)