Skip to content

Commit

Permalink
Remove legacy::FunctionPassManager usage in Codegen_PTX_Dev (#6722)
Browse files Browse the repository at this point in the history
LLVM devs indicate that none of the passes in this usage actually do anything and it can be safely removed.
  • Loading branch information
steven-johnson authored Apr 21, 2022
1 parent 3b3e89e commit accc644
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/CodeGen_PTX_Dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,11 +720,8 @@ vector<char> CodeGen_PTX_Dev::compile_to_src() {
// https://lists.llvm.org/pipermail/llvm-dev/2021-April/150100.html
// https://releases.llvm.org/13.0.0/docs/ReleaseNotes.html#changes-to-the-llvm-ir
// https://groups.google.com/g/llvm-dev/c/HoS07gXx0p8
legacy::FunctionPassManager function_pass_manager(module.get());
legacy::PassManager module_pass_manager;

module_pass_manager.add(createTargetTransformInfoWrapperPass(target_machine->getTargetIRAnalysis()));
function_pass_manager.add(createTargetTransformInfoWrapperPass(target_machine->getTargetIRAnalysis()));

// Override default to generate verbose assembly.
target_machine->Options.MCOptions.AsmVerbose = true;
Expand All @@ -735,19 +732,10 @@ vector<char> CodeGen_PTX_Dev::compile_to_src() {
bool fail = target_machine->addPassesToEmitFile(module_pass_manager, ostream, nullptr,
::llvm::CGFT_AssemblyFile,
true);
if (fail) {
internal_error << "Failed to set up passes to emit PTX source\n";
}

function_pass_manager.doInitialization();
for (auto &function : *module) {
function_pass_manager.run(function);
}
function_pass_manager.doFinalization();
internal_assert(!fail) << "Failed to set up passes to emit PTX source\n";
module_pass_manager.run(*module);

// Codegen pipeline completed.

if (debug::debug_level() >= 2) {
dump();
}
Expand Down

0 comments on commit accc644

Please sign in to comment.