From 17d5e5dd7a2ec97964967583b854409d5daae7ab Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 10 Dec 2021 11:04:13 -0800 Subject: [PATCH 1/2] Document the usage of llvm::legacy::PassManager There is some confusion about whether this usage is acceptable. TL;DR: it's not just acceptable, it's required for the forseeable future. Add comments to capture this to avoid future such questions. (With great thanks to Alina for pointing me at the relevant LLVM discussion links!) --- src/CodeGen_PTX_Dev.cpp | 10 ++++++++++ src/LLVM_Output.cpp | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/CodeGen_PTX_Dev.cpp b/src/CodeGen_PTX_Dev.cpp index 77eb520ef1f0..2c51872073f5 100644 --- a/src/CodeGen_PTX_Dev.cpp +++ b/src/CodeGen_PTX_Dev.cpp @@ -637,6 +637,16 @@ vector CodeGen_PTX_Dev::compile_to_src() { raw_svector_ostream ostream(outstr); ostream.SetUnbuffered(); + // NOTE: use of the "legacy" PassManager here is still required; it is deprecated + // for optimization, but is still the only complete API for codegen as of work-in-progress + // LLVM14. At the time of this comment, there is no firm plan as to when codegen will + // be fully available in the new PassManager, so don't worry about this 'legacy' + // tag until there's any indication that the old APIs start breaking. + // + // See: + // 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; diff --git a/src/LLVM_Output.cpp b/src/LLVM_Output.cpp index c9fa78b66814..c4ee3d1fa725 100644 --- a/src/LLVM_Output.cpp +++ b/src/LLVM_Output.cpp @@ -360,6 +360,17 @@ void emit_file(const llvm::Module &module_in, Internal::LLVMOStream &out, } // Build up all of the passes that we want to do to the module. + + // NOTE: use of the "legacy" PassManager here is still required; it is deprecated + // for optimization, but is still the only complete API for codegen as of work-in-progress + // LLVM14. At the time of this comment, there is no firm plan as to when codegen will + // be fully available in the new PassManager, so don't worry about this 'legacy' + // tag until there's any indication that the old APIs start breaking. + // + // See: + // 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 llvm::legacy::PassManager pass_manager; pass_manager.add(new llvm::TargetLibraryInfoWrapperPass(llvm::Triple(module->getTargetTriple()))); From ce6de4d5b0490549483a74a02594674b67e89078 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 10 Dec 2021 11:30:37 -0800 Subject: [PATCH 2/2] Add date --- src/CodeGen_PTX_Dev.cpp | 2 +- src/LLVM_Output.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CodeGen_PTX_Dev.cpp b/src/CodeGen_PTX_Dev.cpp index 2c51872073f5..1baa55bbd1d0 100644 --- a/src/CodeGen_PTX_Dev.cpp +++ b/src/CodeGen_PTX_Dev.cpp @@ -639,7 +639,7 @@ vector CodeGen_PTX_Dev::compile_to_src() { // NOTE: use of the "legacy" PassManager here is still required; it is deprecated // for optimization, but is still the only complete API for codegen as of work-in-progress - // LLVM14. At the time of this comment, there is no firm plan as to when codegen will + // LLVM14. At the time of this comment (Dec 2021), there is no firm plan as to when codegen will // be fully available in the new PassManager, so don't worry about this 'legacy' // tag until there's any indication that the old APIs start breaking. // diff --git a/src/LLVM_Output.cpp b/src/LLVM_Output.cpp index c4ee3d1fa725..f22481a95b27 100644 --- a/src/LLVM_Output.cpp +++ b/src/LLVM_Output.cpp @@ -363,7 +363,7 @@ void emit_file(const llvm::Module &module_in, Internal::LLVMOStream &out, // NOTE: use of the "legacy" PassManager here is still required; it is deprecated // for optimization, but is still the only complete API for codegen as of work-in-progress - // LLVM14. At the time of this comment, there is no firm plan as to when codegen will + // LLVM14. At the time of this comment (Dec 2021), there is no firm plan as to when codegen will // be fully available in the new PassManager, so don't worry about this 'legacy' // tag until there's any indication that the old APIs start breaking. //