Small jit fixes (#2570)

* Better thunks stripping from jit module.
    * Fixes to jit disassembler
    * Strip comdats from jit module
This commit is contained in:
Ivan Butygin 2018-02-14 17:57:37 +03:00 committed by GitHub
parent 16ecb3e79f
commit bfd412cdf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 145 additions and 49 deletions

View file

@ -109,10 +109,23 @@ struct FuncFinalizer final {
~FuncFinalizer() { fpm.doFinalization(); }
};
void stripComdat(llvm::Module &module) {
for (auto &&func : module.functions()) {
func.setComdat(nullptr);
}
for (auto &&var : module.globals()) {
var.setComdat(nullptr);
}
module.getComdatSymbolTable().clear();
}
} // anon namespace
void optimizeModule(const Context &context, llvm::TargetMachine &targetMachine,
const OptimizerSettings &settings, llvm::Module &module) {
// There is llvm bug related tp comdat and IR based pgo
// and anyway comdat is useless at this stage
stripComdat(module);
llvm::legacy::PassManager mpm;
llvm::legacy::FunctionPassManager fpm(&module);
const auto name = module.getName();