[flang-commits] [flang] [flang] Add -O flag to tco (PR #151869)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Mon Aug 4 02:07:53 PDT 2025


================
@@ -157,9 +179,18 @@ compileFIR(const mlir::PassPipelineCLParser &passPipeline) {
     if (mlir::failed(passPipeline.addToPipeline(pm, errorHandler)))
       return mlir::failure();
   } else {
-    MLIRToLLVMPassPipelineConfig config(llvm::OptimizationLevel::O2);
+    std::optional<llvm::OptimizationLevel> level =
+        getOptimizationLevel(OptLevel);
+    if (!level) {
+      errs() << "Error invalid optimization level\n";
+      return mlir::failure();
+    }
+    MLIRToLLVMPassPipelineConfig config(*level);
+    // TODO: config.StackArrays should be set here?
----------------
tblah wrote:

stack arrays isn't enabled at `-O3` (only `-Ofast`). I think it is okay to leave this as TODO for another patch if anyone wants a flag for it.

https://github.com/llvm/llvm-project/pull/151869


More information about the flang-commits mailing list