I believe calling pm_builder.populateModulePassManager(pm); will cause a bunch of passes to be ran as if you had ran ‘opt -O2’. What do you get if you run ‘opt-3.8 -S -O2 main.ll’?
Thank you very much your fast response!
When typed ‘opt-3.8 -S -O2 main.ll’, I got:
; ModuleID = ‘main.ll’
; Function Attrs: norecurse nounwind readnone
define i32 @main() #0 {
entrypoint:
ret i32 undef
}
attributes #0 = { norecurse nounwind readnone }
This result is the same as my C++ code.
I’m not sure my use of llvm::legacyPassManeger and llvm::PassManagerBuilder. To write inlining in C++, I explored in llvm’s Github and other repositories which use LLVM, then I wrote the C++ code. I’d like to be taught the correct use.