I’ve been trying to run the -wholeprogramdevirt pass in LLVM 12.0.1. Although my pass runs, it doesn’t devirtualize the calls. My program as shown below should be easily devirtualizable.
When I view the optimized version of the LLVM IR, it still uses a vtable lookup in the main() which means the virtual function call was not converted to a direct call.
Some optimizations seem to be dependent on these objects and by default these objects are set to null. I’m wondering if I’m missing any flags to turn on these optimizations.