================
@@ -401,9 +403,25 @@ phases::ID Driver::getFinalPhase(const DerivedArgList &DAL,
   } else if ((PhaseArg = DAL.getLastArg(options::OPT_emit_interface_stubs))) {
     FinalPhase = phases::IfsMerge;
 
-  // Otherwise do everything.
-  } else
-    FinalPhase = phases::Link;
+    // Otherwise, autodetect from last phase triggered by input file
+  } else {
+    llvm::BitVector UsedPhases(phases::MaxNumberOfPhases);
+    for (auto &I : Inputs) {
+      types::ID InputType = I.first;
+      const Arg *InputArg = I.second;
+
+      // Linker options should not trigger more phases
+      if (InputArg->getOption().hasFlag(options::LinkerInput))
+        continue;
+
+      auto PL = types::getCompilationPhases(InputType);
+      for (phases::ID P : PL)
+        UsedPhases.set(P);
+    }
+    FinalPhase = UsedPhases.any()
----------------
Meinersbur wrote:

I don't understand this comment. It *is* a function of the compiler flags and 
input types. Did you read the PR summary?

https://github.com/llvm/llvm-project/pull/218802
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to