diff options
Diffstat (limited to 'llvm/lib/Transforms/IPO/GlobalDCE.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/GlobalDCE.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp index 72b8d7522f04..fb4cb23b837e 100644 --- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp +++ b/llvm/lib/Transforms/IPO/GlobalDCE.cpp @@ -263,6 +263,15 @@ void GlobalDCEPass::AddVirtualFunctionDependencies(Module &M) { if (!ClEnableVFE) return; + // If the Virtual Function Elim module flag is present and set to zero, then + // the vcall_visibility metadata was inserted for another optimization (WPD) + // and we may not have type checked loads on all accesses to the vtable. + // Don't attempt VFE in that case. + auto *Val = mdconst::dyn_extract_or_null<ConstantInt>( + M.getModuleFlag("Virtual Function Elim")); + if (!Val || Val->getZExtValue() == 0) + return; + ScanVTables(M); if (VFESafeVTables.empty()) |