When debugging LTO issues with ld64, we use -save-temps to save the merged
optimized bitcode file, then invoke ld64 again on the single bitcode file.
The saved bitcode file is already internalized, so we can call
lto_codegen_set_should_internalize and skip running internalization again.
rdar://
20227235
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235211
91177308-0d34-0410-b5e6-
96231b3b80d8
* @{
*/
-#define LTO_API_VERSION 13
+#define LTO_API_VERSION 14
/**
* \since prior to LTO_API_VERSION=3
extern void
lto_initialize_disassembler(void);
+/**
+ * Sets if we should run internalize pass during optimization and code
+ * generation.
+ *
+ * \since prior to LTO_API_VERSION=14
+ */
+extern void
+lto_codegen_set_should_internalize(lto_code_gen_t cg,
+ lto_bool_t ShouldInternalize);
+
#ifdef __cplusplus
}
#endif
void setAttr(const char *mAttr) { MAttr = mAttr; }
void setOptLevel(unsigned optLevel) { OptLevel = optLevel; }
+ void setShouldInternalize(bool Value) { ShouldInternalize = Value; }
+
void addMustPreserveSymbol(const char *sym) { MustPreserveSymbols[sym] = 1; }
// To pass options to the driver and optimization passes. These options are
lto_diagnostic_handler_t DiagHandler;
void *DiagContext;
LTOModule *OwnedModule;
+ bool ShouldInternalize;
};
}
#endif
DiagHandler = nullptr;
DiagContext = nullptr;
OwnedModule = nullptr;
+ ShouldInternalize = true;
initializeLTOPasses();
}
}
void LTOCodeGenerator::applyScopeRestrictions() {
- if (ScopeRestrictionsDone)
+ if (ScopeRestrictionsDone || !ShouldInternalize)
return;
Module *mergedModule = IRLinker.getModule();
}
unsigned int lto_api_version() { return LTO_API_VERSION; }
+
+void lto_codegen_set_should_internalize(lto_code_gen_t cg,
+ bool ShouldInternalize) {
+ unwrap(cg)->setShouldInternalize(ShouldInternalize);
+}
lto_codegen_compile_to_file
lto_codegen_optimize
lto_codegen_compile_optimized
+lto_codegen_set_should_internalize
LLVMCreateDisasm
LLVMCreateDisasmCPU
LLVMDisasmDispose