I’m currently seeing different results between running a ModulePassManager
with the default O3 optimization passes and opt -passes='default<O3>'
on the same IR.
Specifically, I have a ModulePassManager
initialized as in Using the New Pass Manager — LLVM 16.0.0git documentation with
MPM = PB.buildPerModuleDefaultPipeline(llvm::PassBuilder::OptimizationLevel::O3);
that I apply to an IR module with MPM.run(module, MAM)
.
However, when I output the same module before optimization with
module->print(llvm::errs(), nullptr, false, true);
and run opt -passes='default<O3>' -S
on the output, I get a different result - despite (from a cursory read of the opt
source) using the same default pipeline without modifications!
Is this expected? Does opt
modify the default pipelines in some way I haven’t caught, or am I doing something wrong in applying the default pipeline? I do see some IR changes from my MPM.run
call, so the pipeline is having some effect, just not the same effect as running through opt
.