masahi commented on a change in pull request #9223:
URL: https://github.com/apache/tvm/pull/9223#discussion_r731343221
##########
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;
+ break;
+
+ default:
+ // CodeGenOpt::Level::Aggressive
+ builder.OptLevel = 3;
Review comment:
A related comment: This code path should hit by default, otherwise this
change would introduce regression.
--
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]