Question regarding MCJIT and optimization

Hi,

I am wondering what the best way is to add optimization passes - I am
using MCJIT in my project. I initially used the example in
Kaleidoscope but found that I needed to add type based analysis to
help optimize away redundant loads.

Then I also discovered PassManagerBuilder.

I have tried following two options but I don't know if a) what the
recommended approach is, and b) is below correct way to use
PassManagerBuilder. Any help / guidance will be very much appreciated.

Regards

Option 1