masahi commented on a change in pull request #9223:
URL: https://github.com/apache/tvm/pull/9223#discussion_r731347240
##########
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:
I think we just inherited opt level being 3 by default from Halide:
https://github.com/halide/Halide/blob/ed87acb466f13144be235a33a30f242e30a6a74f/src/CodeGen_LLVM.cpp#L1145
--
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]