================
@@ -794,12 +815,29 @@ PreservedAnalyses WholeProgramDevirtPass::run(Module &M,
     return FAM.getResult<DominatorTreeAnalysis>(F);
   };
   if (UseCommandLine) {
-    if (!DevirtModule::runForTesting(M, AARGetter, OREGetter, LookupDomTree))
+    if (TestNoLTOMode)
+      // we are outside LTO mode. enable speculative devirtualization:
+      DevirtCheckMode = WPDCheckMode::Fallback;
+    if (!DevirtModule::runForTesting(M, AARGetter, OREGetter, LookupDomTree,
+                                     !TestNoLTOMode))
       return PreservedAnalyses::all();
     return PreservedAnalyses::none();
   }
+  std::optional<ModuleSummaryIndex> Index;
+  // Force Fallback mode as it's safe in case it's non-LTO mode where
+  // we don't have hidden visibility.
+  if (!InLTOMode) {
+    DevirtCheckMode = WPDCheckMode::Fallback;
+    // In non-LTO mode, we don't have an ExportSummary, so we
+    // build the ExportSummary from the module.
+    assert(!ExportSummary &&
----------------
teresajohnson wrote:

Maybe just guard the below code by whether we have an ExportSummary?

https://github.com/llvm/llvm-project/pull/145031
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to