================
@@ -717,47 +718,52 @@ struct DevirtIndex {
PatternList FunctionsToSkip;
+ bool DevirtSpeculatively = false;
+
DevirtIndex(
ModuleSummaryIndex &ExportSummary,
std::set<GlobalValue::GUID> &ExportedGUIDs,
std::map<ValueInfo, std::vector<VTableSlotSummary>> &LocalWPDTargetsMap,
- DenseSet<StringRef> *ExternallyVisibleSymbolNamesPtr)
+ DenseSet<StringRef> *ExternallyVisibleSymbolNamesPtr,
+ const LLVMContext *Ctx)
: ExportSummary(ExportSummary), ExportedGUIDs(ExportedGUIDs),
LocalWPDTargetsMap(LocalWPDTargetsMap),
ExternallyVisibleSymbolNamesPtr(ExternallyVisibleSymbolNamesPtr) {
FunctionsToSkip.init(SkipFunctionNames);
+ if (Ctx)
+ DevirtSpeculatively =
+
Ctx->getLibraryOptions().get<IPOOptions>().devirtualize_speculatively;
}
bool tryFindVirtualCallTargets(std::vector<ValueInfo> &TargetsForSlot,
const TypeIdCompatibleVtableInfo TIdInfo,
- uint64_t ByteOffset);
+ uint64_t ByteOffset, bool &HasPublicTarget);
bool trySingleImplDevirt(MutableArrayRef<ValueInfo> TargetsForSlot,
VTableSlotSummary &SlotSummary,
VTableSlotInfo &SlotInfo,
WholeProgramDevirtResolution *Res,
- std::set<ValueInfo> &DevirtTargets);
+ std::set<ValueInfo> &DevirtTargets,
+ bool HasPublicTarget);
void run();
};
} // end anonymous namespace
PreservedAnalyses WholeProgramDevirtPass::run(Module &M,
ModuleAnalysisManager &MAM) {
+ DevirtSpeculatively |= getIPOOptions(M).devirtualize_speculatively;
----------------
hassnaaHamdi wrote:
I think passing this value to `runForTesting` and changing the function
prototype are not needed as that function already is accessing `getIPOOptions`,
so it can access `devirtualize_speculatively`.
https://github.com/llvm/llvm-project/pull/233380
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits