clover/llvm: Trivial codestyle clean-up for optimize().
Reviewed-by: Serge Martin <edb+mesa@sigluy.net> Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
This commit is contained in:
@@ -278,10 +278,10 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
optimize(llvm::Module *mod, unsigned optimization_level) {
|
optimize(Module &mod, unsigned optimization_level) {
|
||||||
compat::pass_manager PM;
|
compat::pass_manager pm;
|
||||||
|
|
||||||
compat::add_data_layout_pass(PM);
|
compat::add_data_layout_pass(pm);
|
||||||
|
|
||||||
// By default, the function internalizer pass will look for a function
|
// By default, the function internalizer pass will look for a function
|
||||||
// called "main" and then mark all other functions as internal. Marking
|
// called "main" and then mark all other functions as internal. Marking
|
||||||
@@ -295,15 +295,15 @@ namespace {
|
|||||||
// list of kernel functions to the internalizer. The internalizer will
|
// list of kernel functions to the internalizer. The internalizer will
|
||||||
// treat the functions in the list as "main" functions and internalize
|
// treat the functions in the list as "main" functions and internalize
|
||||||
// all of the other functions.
|
// all of the other functions.
|
||||||
compat::add_internalize_pass(PM, map(std::mem_fn(&Function::getName),
|
compat::add_internalize_pass(pm, map(std::mem_fn(&Function::getName),
|
||||||
find_kernels(mod)));
|
find_kernels(&mod)));
|
||||||
|
|
||||||
llvm::PassManagerBuilder PMB;
|
::llvm::PassManagerBuilder pmb;
|
||||||
PMB.OptLevel = optimization_level;
|
pmb.OptLevel = optimization_level;
|
||||||
PMB.LibraryInfo = new compat::target_library_info(
|
pmb.LibraryInfo = new compat::target_library_info(
|
||||||
llvm::Triple(mod->getTargetTriple()));
|
::llvm::Triple(mod.getTargetTriple()));
|
||||||
PMB.populateModulePassManager(PM);
|
pmb.populateModulePassManager(pm);
|
||||||
PM.run(*mod);
|
pm.run(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kernel metadata
|
// Kernel metadata
|
||||||
@@ -790,7 +790,7 @@ clover::compile_program_llvm(const std::string &source,
|
|||||||
r_log);
|
r_log);
|
||||||
auto mod = compile(*ctx, *c, "input.cl", source, headers, target, opts, r_log);
|
auto mod = compile(*ctx, *c, "input.cl", source, headers, target, opts, r_log);
|
||||||
|
|
||||||
optimize(&*mod, c->getCodeGenOpts().OptimizationLevel);
|
optimize(*mod, c->getCodeGenOpts().OptimizationLevel);
|
||||||
|
|
||||||
if (get_debug_flags() & DBG_LLVM) {
|
if (get_debug_flags() & DBG_LLVM) {
|
||||||
std::string log;
|
std::string log;
|
||||||
|
Reference in New Issue
Block a user