masahi commented on a change in pull request #9223:
URL: https://github.com/apache/tvm/pull/9223#discussion_r731342213
##########
File path: src/target/llvm/codegen_llvm.cc
##########
@@ -343,7 +345,26 @@ void CodeGenLLVM::Optimize() {
// place optimization pass
llvm::PassManagerBuilder builder;
- builder.OptLevel = 3;
+
+ // Use the same opt-level as specified in TargetMachine for running passes
+ llvm::CodeGenOpt::Level opt_level = target_machine_->getOptLevel();
+
+ switch (opt_level) {
+ case llvm::CodeGenOpt::Level::None:
+ builder.OptLevel = 0;
+ break;
+ case llvm::CodeGenOpt::Level::Less:
+ builder.OptLevel = 1;
+ break;
+
+ case llvm::CodeGenOpt::Level::Default:
+ builder.OptLevel = 2;
Review comment:
Since you are using
`target->GetAttr<Integer>("O").value_or(Integer(2));` in `llvm_common.cc`, do
we always hit this code path if users do not specify the opt level?
Previously we were always using `builder.OptLevel = 3;`, so the default here
shouldn't change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]