diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c6bb33b8..fa5583c07 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,24 +51,10 @@ jobs: fail-fast: false matrix: include: - # - desc: gcc9/C++17 llvm11 py3.7 oiio2.5 sse4 batch-b8avx2 - # nametag: linux-vfx2021 - # runner: ubuntu-latest - # container: aswftesting/ci-osl:2021-clang11 - # vfxyear: 2021 - # old_node: 1 - # cxx_std: 17 - # openexr_ver: v3.1.3 - # openimageio_ver: v2.5.4.0 - # python_ver: 3.7 - # pybind11_ver: v2.7.0 - # simd: sse4.2 - # batched: b8_AVX2_noFMA - # setenvs: export USE_OPENVDB=0 - - desc: gcc9/C++17 llvm13 py3.9 exr3.1 oiio-rel avx2 + - desc: gcc9/C++17 llvm14 py3.9 exr3.1 oiio-rel avx2 nametag: linux-vfx2022 runner: ubuntu-latest - container: aswftesting/ci-osl:2022-clang13 + container: aswftesting/ci-osl:2022-clang14 vfxyear: 2022 old_node: 1 cxx_std: 17 @@ -77,10 +63,10 @@ jobs: pybind11_ver: v2.9.0 simd: avx2,f16c batched: b8_AVX2 - - desc: clang12/C++17 llvm12 oiio-main py3.9 avx2 batch-avx512 - nametag: linux-clang12-llvm12-batch + - desc: clang14/C++17 llvm14 oiio-main py3.9 avx2 batch-avx512 + nametag: linux-clang14-llvm14-batch runner: ubuntu-latest - container: aswftesting/ci-osl:2022-clang12 + container: aswftesting/ci-osl:2022-clang14 vfxyear: 2022 old_node: 1 cxx_std: 17 @@ -91,10 +77,10 @@ jobs: simd: avx2,f16c batched: b8_AVX2,b8_AVX512,b16_AVX512 setenvs: USE_OPENVDB=0 - - desc: gcc9/C++17 llvm11 py3.9 exr3.1 oiio3.0 sse2 batch-b4sse2 + - desc: gcc9/C++17 llvm14 py3.9 exr3.1 oiio3.0 sse2 batch-b4sse2 nametag: linux-vfx2022-clang runner: ubuntu-latest - container: aswftesting/ci-osl:2022-clang13 + container: aswftesting/ci-osl:2022-clang14 vfxyear: 2022 old_node: 1 cxx_std: 17 @@ -104,10 +90,10 @@ jobs: pybind11_ver: v2.9.0 simd: sse2 batched: b4_SSE2 - - desc: oldest everything gcc9/C++17 llvm11 py3.9 oiio2.5 no-simd + - desc: oldest everything gcc9/C++17 llvm14 py3.9 oiio2.5 no-simd nametag: linux-oldest runner: ubuntu-latest - container: aswftesting/ci-osl:2022-clang11 + container: aswftesting/ci-osl:2022-clang14 vfxyear: 2022 old_node: 1 cxx_std: 17 @@ -280,7 +266,7 @@ jobs: # ^^ exclude python-oslquery test until the ASWF container properly # includes OIIO's python bindings, then we can remove that. - # Address and leak sanitizers + # Address and leak sanitizers (debug build) - desc: sanitizers nametag: sanitizer runner: ubuntu-latest @@ -386,8 +372,8 @@ jobs: USE_OPENVDB=0 OPENCOLORIO_CMAKE_FLAGS="-DCMAKE_CXX_COMPILER=g++" - - desc: Debug gcc9/C++17 llvm11 py3.10 oiio2.5 exr3.1 sse4 - nametag: linux-debug-gcc7-llvm11 + - desc: Debug gcc9/C++17 llvm14 py3.10 oiio2.5 exr3.1 sse4 + nametag: linux-debug-gcc9-llvm14 runner: ubuntu-22.04 cxx_compiler: g++-9 cxx_std: 17 @@ -397,11 +383,11 @@ jobs: python_ver: "3.10" simd: sse4.2 setenvs: export CMAKE_BUILD_TYPE=Debug - LLVM_VERSION=11.0.0 LLVM_DISTRO_NAME=ubuntu-20.04 + LLVM_VERSION=14.0.0 LLVM_DISTRO_NAME=ubuntu-18.04 PUGIXML_VERSION=v1.9 CTEST_TEST_TIMEOUT=240 - - desc: gcc10/C++17 llvm11 oiio-2.5 avx2 - nametag: linux-2021ish-gcc10-llvm11 + - desc: gcc10/C++17 llvm14 oiio-2.5 avx2 + nametag: linux-2021ish-gcc10-llvm14 runner: ubuntu-22.04 cxx_compiler: g++-10 cxx_std: 17 @@ -411,7 +397,7 @@ jobs: pybind11_ver: v2.8.1 python_ver: "3.10" simd: avx2,f16c - setenvs: export LLVM_VERSION=11.0.0 LLVM_DISTRO_NAME=ubuntu-20.04 + setenvs: export LLVM_VERSION=14.0.0 LLVM_DISTRO_NAME=ubuntu-18.04 OPENIMAGEIO_CMAKE_FLAGS="-DBUILD_FMT_VERSION=7.0.1" PUGIXML_VERSION=v1.10 - desc: latest releases gcc11/C++17 llvm17 oiio-3.0 exr3.2 py3.12 avx2 batch-b16avx512 diff --git a/INSTALL.md b/INSTALL.md index e78fb9c63..8ea14dd48 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -19,17 +19,17 @@ Dependencies OSL requires the following dependencies or tools. NEW or CHANGED minimum dependencies since the last major release are **bold**. -* Build system: [CMake](https://cmake.org/) **3.19 or newer** (tested +* Build system: [CMake](https://cmake.org/) 3.19 or newer (tested through 4.0) * A suitable C++17 compiler to build OSL itself, which may be any of: - - **GCC 9.3** or newer (tested through gcc 13.1) - - **Clang 5** or newer (tested through clang 19) + - GCC 9.3 or newer (tested through gcc 13.1) + - Clang 5 or newer (tested through clang 20) - Microsoft Visual Studio 2017 or newer - - Intel C++ compiler **icc version 19** or newer or LLVM-based icx compiler + - Intel C++ compiler icc version 19 or newer or LLVM-based icx compiler version 2022 or newer. -* **[OpenImageIO](http://openimageio.org) 2.5 or newer** (tested through 3.0 +* [OpenImageIO](http://openimageio.org) 2.5 or newer (tested through 3.0 and main) OSL uses OIIO both for its texture mapping functionality as well as @@ -49,15 +49,15 @@ NEW or CHANGED minimum dependencies since the last major release are **bold**. $OpenImageIO_ROOT/lib to be in your LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH on OS X). -* [LLVM](http://www.llvm.org) 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, including - clang libraries. +* [LLVM](http://www.llvm.org) **14.0 or newer**, 15, 16, 17, 18, 19, 20, + including clang libraries. * (optional) For GPU rendering on NVIDIA GPUs: * [OptiX](https://developer.nvidia.com/rtx/ray-tracing/optix) 7.0 or higher. * [Cuda](https://developer.nvidia.com/cuda-downloads) 9.0 or higher. It is recommended that you use 11.0 or higher. -* [Imath](https://github.com/AcademySoftwareFoundation/Imath) **3.1 or newer**. +* [Imath](https://github.com/AcademySoftwareFoundation/Imath) 3.1 or newer. * [Flex](https://github.com/westes/flex) 2.5.35 or newer and [GNU Bison](https://www.gnu.org/software/bison/) 2.7 or newer. Note that on some MacOS/xcode releases, the system-installed Bison is too @@ -70,7 +70,7 @@ NEW or CHANGED minimum dependencies since the last major release are **bold**. * (optional) Python: If you are building the Python bindings or running the testsuite: * **Python >= 3.9** (tested through 3.13) - * **pybind11 >= 2.7** (tested through 3.0) + * pybind11 >= 2.7 (tested through 3.0) * NumPy (tested through 2.2.4) * (optional) Qt5 >= 5.6 or Qt6 (tested Qt5 through 5.15 and Qt6 through 6.8). If not found at build time, the `osltoy` application will be disabled. diff --git a/Makefile b/Makefile index 568846063..c02e4080a 100644 --- a/Makefile +++ b/Makefile @@ -359,7 +359,7 @@ help: @echo " Finding and Using Dependencies:" @echo " USE_QT=0 Skip anything that needs Qt" @echo " LLVM-related options:" - @echo " LLVM_VERSION=12.0 Specify which LLVM version to use" + @echo " LLVM_VERSION=19.0 Specify which LLVM version to use" @echo " LLVM_DIRECTORY=xx Specify where LLVM lives" @echo " LLVM_NAMESPACE=xx Specify custom LLVM namespace" @echo " LLVM_STATIC=1 Use static LLVM libraries" diff --git a/src/cmake/cuda_macros.cmake b/src/cmake/cuda_macros.cmake index 00e2c77f7..e87b359f1 100644 --- a/src/cmake/cuda_macros.cmake +++ b/src/cmake/cuda_macros.cmake @@ -134,12 +134,6 @@ function ( MAKE_CUDA_BITCODE src suffix generated_bc extra_clang_args ) set (CLANG_MSVC_FIX -Wno-ignored-attributes -Wno-unknown-attributes) endif () - if (NOT LLVM_OPAQUE_POINTERS AND ${LLVM_VERSION} VERSION_GREATER_EQUAL 15.0) - # Until we fully support opaque pointers, we need to disable - # them when using LLVM 15. - list (APPEND LLVM_COMPILE_FLAGS -Xclang -no-opaque-pointers) - endif () - if (NOT CUDA_NO_FTZ) set (CLANG_FTZ_FLAG "-fcuda-flush-denormals-to-zero") endif () @@ -221,14 +215,10 @@ function ( CUDA_SHADEOPS_COMPILE prefix output_bc output_ptx input_srcs headers list ( APPEND shadeops_bc_list ${shadeops_bc} ) endforeach () - if (LLVM_NEW_PASS_MANAGER) - # There is no --nvptx-assign-valid-global-names flag for the new - # pass manager, but it appears to run this pass by default. - string(REPLACE "-O" "O" opt_tool_flags ${CUDA_OPT_FLAG_CLANG}) - set (opt_tool_flags -passes="default<${opt_tool_flags}>") - else() - set (opt_tool_flags ${CUDA_OPT_FLAG_CLANG} --nvptx-assign-valid-global-names) - endif () + # There is no --nvptx-assign-valid-global-names flag for the new + # pass manager, but it appears to run this pass by default. + string(REPLACE "-O" "O" opt_tool_flags ${CUDA_OPT_FLAG_CLANG}) + set (opt_tool_flags -passes="default<${opt_tool_flags}>") # Link all of the individual LLVM bitcode files, and emit PTX for the linked bitcode add_custom_command ( OUTPUT ${linked_bc} ${linked_ptx} diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake index 819a6cf15..59a992d37 100644 --- a/src/cmake/externalpackages.cmake +++ b/src/cmake/externalpackages.cmake @@ -57,7 +57,7 @@ checked_find_package (pugixml REQUIRED # LLVM library setup checked_find_package (LLVM REQUIRED - VERSION_MIN 11.0 + VERSION_MIN 14.0 VERSION_MAX 20.9 PRINT LLVM_SYSTEM_LIBRARIES CLANG_LIBRARIES LLVM_SHARED_MODE) @@ -79,36 +79,7 @@ if (LLVM_VERSION VERSION_GREATER_EQUAL 15.0 AND CMAKE_COMPILER_IS_CLANG "If you are using LLVM 15 or higher, you should also use clang version " "15 or higher, or you may get build errors.${ColorReset}\n") endif () -if (LLVM_VERSION VERSION_GREATER_EQUAL 16.0) - if (CMAKE_CXX_STANDARD VERSION_LESS 17) - message (WARNING "${ColorYellow}LLVM 16+ requires C++17 or higher. " - "Please set CMAKE_CXX_STANDARD to 17 or higher.${ColorReset}\n") - endif () - if (CMAKE_COMPILER_IS_GNUCC AND (GCC_VERSION VERSION_LESS 7.0)) - message (WARNING "${ColorYellow}LLVM 16+ requires gcc 7.0 or higher.${ColorReset}\n") - endif () - if (CMAKE_COMPILER_IS_CLANG - AND NOT (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 5.0 - OR APPLECLANG_VERSION_STRING VERSION_GREATER_EQUAL 5.0)) - message (WARNING "${ColorYellow}LLVM 16+ requires clang 5.0 or higher.${ColorReset}\n") - endif () -endif () -# Use opaque pointers starting with LLVM 16 -if (${LLVM_VERSION} VERSION_GREATER_EQUAL 16.0) - set(LLVM_OPAQUE_POINTERS ON) - add_compile_definitions (OSL_LLVM_OPAQUE_POINTERS) -else() - set(LLVM_OPAQUE_POINTERS OFF) -endif() - -# Enable new pass manager for LLVM 16+ -if (${LLVM_VERSION} VERSION_GREATER_EQUAL 16.0) - set(LLVM_NEW_PASS_MANAGER ON) - add_compile_definitions (OSL_LLVM_NEW_PASS_MANAGER) -else() - set(LLVM_NEW_PASS_MANAGER OFF) -endif() checked_find_package (partio) diff --git a/src/cmake/llvm_macros.cmake b/src/cmake/llvm_macros.cmake index 6ffdd1ab0..fea5549dd 100644 --- a/src/cmake/llvm_macros.cmake +++ b/src/cmake/llvm_macros.cmake @@ -74,12 +74,6 @@ function ( EMBED_LLVM_BITCODE_IN_CPP src_list suffix output_name list_to_append_ list (TRANSFORM include_dirs PREPEND -I OUTPUT_VARIABLE ALL_INCLUDE_DIRS) - if (NOT LLVM_OPAQUE_POINTERS AND ${LLVM_VERSION} VERSION_GREATER_EQUAL 15.0) - # Until we fully support opaque pointers, we need to disable - # them when using LLVM 15. - list (APPEND LLVM_COMPILE_FLAGS -Xclang -no-opaque-pointers) - endif () - # Command to turn the .cpp file into LLVM assembly language .s, into # LLVM bitcode .bc, then back into a C++ file with the bc embedded! add_custom_command ( OUTPUT ${src_bc} diff --git a/src/include/OSL/llvm_util.h b/src/include/OSL/llvm_util.h index be0ea444d..c10f161ae 100644 --- a/src/include/OSL/llvm_util.h +++ b/src/include/OSL/llvm_util.h @@ -1240,7 +1240,6 @@ class OSLEXECPUBLIC LLVM_Util { llvm::Value* op_combine_4x_vectors(llvm::Value* half_vec_1, llvm::Value* half_vec_2); - void setup_legacy_optimization_passes(int optlevel, bool target_host); void setup_new_optimization_passes(int optlevel, bool target_host); }; diff --git a/src/liboslexec/batched_backendllvm.cpp b/src/liboslexec/batched_backendllvm.cpp index ddce7776d..543cbc2cf 100644 --- a/src/liboslexec/batched_backendllvm.cpp +++ b/src/liboslexec/batched_backendllvm.cpp @@ -1304,25 +1304,6 @@ BatchedBackendLLVM::llvm_store_value(llvm::Value* new_val, llvm::Value* dst_ptr, if (!type.is_closure_based() && t.aggregate > 1) dst_ptr = ll.GEP(dst_type, dst_ptr, 0, component); -#ifndef OSL_LLVM_OPAQUE_POINTERS - if ((const llvm::Type*)ll.type_ptr(ll.llvm_typeof(new_val)) - != ll.llvm_typeof(dst_ptr)) { - std::cerr << " new_val type="; - { - llvm::raw_os_ostream os_cerr(std::cerr); - ll.llvm_typeof(new_val)->print(os_cerr); - } - std::cerr << " dest_ptr type="; - { - llvm::raw_os_ostream os_cerr(std::cerr); - ll.llvm_typeof(dst_ptr)->print(os_cerr); - } - std::cerr << std::endl; - } - OSL_ASSERT((const llvm::Type*)ll.type_ptr(ll.llvm_typeof(new_val)) - == ll.llvm_typeof(dst_ptr)); -#endif - // Finally, store the value. ll.op_store(new_val, dst_ptr); return true; diff --git a/src/liboslexec/batched_llvm_gen.cpp b/src/liboslexec/batched_llvm_gen.cpp index c3a052e58..145b5ba61 100644 --- a/src/liboslexec/batched_llvm_gen.cpp +++ b/src/liboslexec/batched_llvm_gen.cpp @@ -1056,18 +1056,6 @@ LLVMGEN(llvm_gen_andor) // sometimes we could not force the data type to be an bool and it remains // an int, for those cases we will need to convert the boolean to int if (!result.forced_llvm_bool()) { -#ifndef OSL_LLVM_OPAQUE_POINTERS - llvm::Type* resultType = rop.ll.llvm_typeof( - rop.llvm_get_pointer(result)); - OSL_ASSERT( - (resultType - == reinterpret_cast(rop.ll.type_wide_int_ptr())) - || (resultType - == reinterpret_cast(rop.ll.type_int_ptr()))); - llvm::Type* typeOfR = rop.ll.llvm_typeof(i1_res); - OSL_ASSERT(typeOfR == rop.ll.type_wide_bool() - || typeOfR == rop.ll.type_bool()); -#endif i1_res = rop.ll.op_bool_to_int(i1_res); } @@ -2170,15 +2158,6 @@ LLVMGEN(llvm_gen_bitwise_binary_op) // We allowed boolean values to pass through or,and,xor // so we might need to promote to integer before storage if (!Result.forced_llvm_bool()) { -#ifndef OSL_LLVM_OPAQUE_POINTERS - llvm::Type* resultType = rop.ll.llvm_typeof( - rop.llvm_get_pointer(Result)); - OSL_ASSERT( - (resultType - == reinterpret_cast(rop.ll.type_wide_int_ptr())) - || (resultType - == reinterpret_cast(rop.ll.type_int_ptr()))); -#endif llvm::Type* typeOfR = rop.ll.llvm_typeof(r); if (typeOfR == rop.ll.type_wide_bool() || typeOfR == rop.ll.type_bool()) { @@ -3075,15 +3054,6 @@ LLVMGEN(llvm_gen_compare_op) final_result = rop.ll.llvm_mask_to_native(final_result); } } else { -#ifndef OSL_LLVM_OPAQUE_POINTERS - llvm::Type* resultType = rop.ll.llvm_typeof( - rop.llvm_get_pointer(Result)); - OSL_ASSERT( - (resultType - == reinterpret_cast(rop.ll.type_wide_int_ptr())) - || (resultType - == reinterpret_cast(rop.ll.type_int_ptr()))); -#endif final_result = rop.ll.op_bool_to_int(final_result); } diff --git a/src/liboslexec/llvm_passes.h b/src/liboslexec/llvm_passes.h index 99014e3cc..a6fe1a1d4 100644 --- a/src/liboslexec/llvm_passes.h +++ b/src/liboslexec/llvm_passes.h @@ -68,16 +68,10 @@ template class PreventBitMasksFromBeingLiveinsToBasicBlocks { // what the native mask type should be. And if necessary maintain a // 16 bit and 32 bit native mask representation to be passed as a // livein. - m_native_mask_type = llvm::FixedVectorType::get(llvm_type_int32, - WidthT); -#if OSL_LLVM_VERSION >= 112 + m_native_mask_type = llvm::FixedVectorType::get(llvm_type_int32, + WidthT); m_wide_zero_initializer = llvm::ConstantDataVector::getSplat( WidthT, llvm::ConstantInt::get(context, llvm::APInt(32, 0))); -#else - m_wide_zero_initializer = llvm::ConstantVector::getSplat( - llvm::ElementCount(WidthT, false), - llvm::ConstantInt::get(context, llvm::APInt(32, 0))); -#endif } bool run(llvm::Function& F) const @@ -404,37 +398,6 @@ class NewPreventBitMasksFromBeingLiveinsToBasicBlocks final } }; -// Legacy pass manager adapter -template -class LegacyPreventBitMasksFromBeingLiveinsToBasicBlocks final - : public llvm::FunctionPass { - PreventBitMasksFromBeingLiveinsToBasicBlocks m_pass; - -public: - static char ID; - - LegacyPreventBitMasksFromBeingLiveinsToBasicBlocks() : FunctionPass(ID) {} - - bool doInitialization(llvm::Module& M) override - { - m_pass.initialize(M.getContext()); - return false; // Module was not changed - } - - bool runOnFunction(llvm::Function& F) override { return m_pass.run(F); } -}; - -// No need to worry about static variable collisions if included multiple -// places because of the anonymous namespace, each translation unit -// including this file will need its own static members defined. LLVM will -// assign IDs when they get registered, so this initialization value is not -// important. -template<> char LegacyPreventBitMasksFromBeingLiveinsToBasicBlocks<4>::ID = 0; - -template<> char LegacyPreventBitMasksFromBeingLiveinsToBasicBlocks<8>::ID = 0; - -template<> char LegacyPreventBitMasksFromBeingLiveinsToBasicBlocks<16>::ID = 0; - } // end of anonymous namespace } // namespace pvt diff --git a/src/liboslexec/llvm_util.cpp b/src/liboslexec/llvm_util.cpp index ad85cec1e..f9b1296d6 100644 --- a/src/liboslexec/llvm_util.cpp +++ b/src/liboslexec/llvm_util.cpp @@ -13,8 +13,8 @@ #include #include -#if OSL_LLVM_VERSION < 110 -# error "LLVM minimum version required for OSL is 11.0" +#if OSL_LLVM_VERSION < 140 +# error "LLVM minimum version required for OSL is 14.0" #endif OSL_PRAGMA_WARNING_PUSH @@ -51,12 +51,8 @@ OSL_GCC_PRAGMA(GCC diagnostic ignored "-Wmaybe-uninitialized") #else # include #endif +#include #include -#if OSL_LLVM_VERSION < 140 -# include -#else -# include -#endif #include #include @@ -86,46 +82,39 @@ OSL_GCC_PRAGMA(GCC diagnostic ignored "-Wmaybe-uninitialized") #include -#if OSL_LLVM_VERSION >= 120 -# include -#endif +#include -#ifdef OSL_LLVM_NEW_PASS_MANAGER // New pass manager -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -#else -// Legacy pass manager -# include -#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // additional includes for PTX generation #include @@ -198,9 +187,7 @@ static std::unique_ptr>> static int jit_mem_hold_users = 0; -#if OSL_LLVM_VERSION >= 120 llvm::raw_os_ostream raw_cout(std::cout); -#endif }; // namespace @@ -396,14 +383,11 @@ class LLVM_Util::IRBuilder final // New pass manager state, mainly here because these are template classes // for which forward declarations in a public header are tricky. struct LLVM_Util::NewPassManager { -#ifdef OSL_LLVM_NEW_PASS_MANAGER llvm::LoopAnalysisManager loop_analysis_manager; llvm::FunctionAnalysisManager function_analysis_manager; llvm::CGSCCAnalysisManager cgscc_analysis_manager; llvm::ModuleAnalysisManager module_analysis_manager; - llvm::ModulePassManager module_pass_manager; -#endif }; @@ -457,12 +441,6 @@ LLVM_Util::LLVM_Util(const PerThreadInfo& per_thread_info, int debuglevel, OIIO::spin_lock lock(llvm_global_mutex); if (!m_thread->llvm_context) { m_thread->llvm_context = new llvm::LLVMContext(); -#if OSL_LLVM_VERSION >= 150 && !defined(OSL_LLVM_OPAQUE_POINTERS) - m_thread->llvm_context->setOpaquePointers(false); - // FIXME: For now, keep using typed pointers. We're going to have - // to fix this and switch to opaque pointers by llvm 16. -#endif - //static SetCommandLineOptionsForLLVM sSetCommandLineOptionsForLLVM; } if (!m_thread->llvm_jitmm) { @@ -622,28 +600,6 @@ LLVM_Util::SetupLLVM() llvm::initializeTarget(registry); llvm::initializeCodeGen(registry); -#ifndef OSL_LLVM_NEW_PASS_MANAGER - // LegacyPreventBitMasksFromBeingLiveinsToBasicBlocks - static llvm::RegisterPass< - LegacyPreventBitMasksFromBeingLiveinsToBasicBlocks<4>> - sRegCustomPass2( - "PreventBitMasksFromBeingLiveinsToBasicBlocks<4>", - "Prevent Bit Masks <4xi1> From Being Liveins To Basic Blocks Pass", - false /* Only looks at CFG */, false /* Analysis Pass */); - static llvm::RegisterPass< - LegacyPreventBitMasksFromBeingLiveinsToBasicBlocks<8>> - sRegCustomPass0( - "PreventBitMasksFromBeingLiveinsToBasicBlocks<8>", - "Prevent Bit Masks <8xi1> From Being Liveins To Basic Blocks Pass", - false /* Only looks at CFG */, false /* Analysis Pass */); - static llvm::RegisterPass< - LegacyPreventBitMasksFromBeingLiveinsToBasicBlocks<16>> - sRegCustomPass1( - "PreventBitMasksFromBeingLiveinsToBasicBlocks<16>", - "Prevent Bit Masks <16xi1> From Being Liveins To Basic Blocks Pass", - false /* Only looks at CFG */, false /* Analysis Pass */); -#endif - if (debug()) { for (auto t : llvm::TargetRegistry::targets()) std::cout << "Target: '" << t.getName() << "' " @@ -1559,12 +1515,9 @@ LLVM_Util::make_jit_execengine(std::string* err, TargetISA requestedISA, options.NoZerosInBSS = false; options.GuaranteedTailCallOpt = false; -#if OSL_LLVM_VERSION < 120 - options.StackAlignmentOverride = 0; -#endif - options.FunctionSections = true; - options.UseInitArray = false; - options.FloatABIType = llvm::FloatABI::Default; + options.FunctionSections = true; + options.UseInitArray = false; + options.FloatABIType = llvm::FloatABI::Default; #if OSL_LLVM_VERSION < 190 options.RelaxELFRelocations = false; #endif @@ -1818,10 +1771,7 @@ LLVM_Util::nvptx_target_machine() options.AllowFPOpFusion = llvm::FPOpFusion::Fast; options.NoZerosInBSS = 0; options.GuaranteedTailCallOpt = 0; -#if OSL_LLVM_VERSION < 120 - options.StackAlignmentOverride = 0; -#endif - options.UseInitArray = 0; + options.UseInitArray = 0; // Verify that the NVPTX target has been initialized std::string error; @@ -1892,21 +1842,12 @@ LLVM_Util::InstallLazyFunctionCreator(void* (*P)(const std::string&)) void LLVM_Util::setup_optimization_passes(int optlevel, bool target_host) { -#ifdef OSL_LLVM_NEW_PASS_MANAGER setup_new_optimization_passes(optlevel, target_host); -#else - setup_legacy_optimization_passes(optlevel, target_host); -#endif } void LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) { -#ifdef OSL_LLVM_NEW_PASS_MANAGER -# if OSL_LLVM_VERSION <= 110 -# error "New pass manager not supported in LLVM 11 and earlier" -# endif - OSL_DEV_ONLY(std::cout << "setup_new_optimization_passes " << optlevel); OSL_ASSERT(m_new_pass_manager == nullptr); @@ -2004,7 +1945,7 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) case 12: { llvm::ModulePassManager& mpm = m_new_pass_manager->module_pass_manager; -# if 0 // PRETTY_GOOD_KEEP_AS_REF +#if 0 // PRETTY_GOOD_KEEP_AS_REF mpm.addPass(llvm::ModuleInlinerWrapperPass()); mpm.addPass( llvm::createModuleToFunctionPassAdaptor(llvm::SimplifyCFGPass())); @@ -2013,11 +1954,11 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) { llvm::FunctionPassManager fpm; fpm.addPass(llvm::SimplifyCFGPass()); -# if OSL_LLVM_VERSION < 160 +# if OSL_LLVM_VERSION < 160 fpm.addPass(llvm::SROAPass()); -# else +# else fpm.addPass(llvm::SROAPass(llvm::SROAOptions::PreserveCFG)); -# endif +# endif fpm.addPass(llvm::EarlyCSEPass()); fpm.addPass(llvm::ReassociatePass()); @@ -2031,11 +1972,11 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) fpm.addPass(llvm::DCEPass()); fpm.addPass(llvm::JumpThreadingPass()); -# if OSL_LLVM_VERSION < 160 +# if OSL_LLVM_VERSION < 160 fpm.addPass(llvm::SROAPass()); -# else +# else fpm.addPass(llvm::SROAPass(llvm::SROAOptions::PreserveCFG)); -# endif +# endif fpm.addPass(llvm::InstCombinePass()); // Added @@ -2045,7 +1986,7 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) mpm.addPass(llvm::GlobalDCEPass()); mpm.addPass(llvm::ConstantMergePass()); -# else +#else mpm.addPass(llvm::ModuleInlinerWrapperPass()); mpm.addPass( llvm::createModuleToFunctionPassAdaptor(llvm::SimplifyCFGPass())); @@ -2054,14 +1995,14 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) { llvm::FunctionPassManager fpm; fpm.addPass(llvm::SimplifyCFGPass()); -# if OSL_LLVM_VERSION < 160 +# if OSL_LLVM_VERSION < 160 fpm.addPass(llvm::SROAPass()); -# else +# else // PreserveCFG is the same behavior as earlier versions, but changing // to ModifyCFG here and other places may improve performance. // https://reviews.llvm.org/D138238 fpm.addPass(llvm::SROAPass(llvm::SROAOptions::PreserveCFG)); -# endif +# endif fpm.addPass(llvm::EarlyCSEPass()); // Eliminate and remove as much as possible up front @@ -2082,7 +2023,11 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) llvm::LoopPassManager lpm; const bool use_memory_ssa = true; // Needed by LICM lpm.addPass(llvm::LoopRotatePass()); +# if OSL_LLVM_VERSION >= 150 lpm.addPass(llvm::LICMPass(llvm::LICMOptions())); +# else + lpm.addPass(llvm::LICMPass()); +# endif lpm.addPass(llvm::SimpleLoopUnswitchPass(false)); fpm.addPass(createFunctionToLoopPassAdaptor(std::move(lpm), use_memory_ssa)); @@ -2121,7 +2066,7 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) mpm.addPass(llvm::GlobalDCEPass()); mpm.addPass(llvm::ConstantMergePass()); -# endif +#endif break; } case 13: { @@ -2132,11 +2077,11 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) { llvm::FunctionPassManager fpm; fpm.addPass(llvm::SimplifyCFGPass()); -# if OSL_LLVM_VERSION < 160 +#if OSL_LLVM_VERSION < 160 fpm.addPass(llvm::SROAPass()); -# else +#else fpm.addPass(llvm::SROAPass(llvm::SROAOptions::PreserveCFG)); -# endif +#endif fpm.addPass(llvm::EarlyCSEPass()); fpm.addPass(llvm::LowerExpectIntrinsicPass()); @@ -2153,11 +2098,11 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) fpm.addPass(llvm::InstCombinePass()); fpm.addPass(llvm::DCEPass()); -# if OSL_LLVM_VERSION < 160 +#if OSL_LLVM_VERSION < 160 fpm.addPass(llvm::SROAPass()); -# else +#else fpm.addPass(llvm::SROAPass(llvm::SROAOptions::PreserveCFG)); -# endif +#endif fpm.addPass(llvm::InstCombinePass()); fpm.addPass(llvm::SimplifyCFGPass()); fpm.addPass(llvm::PromotePass()); @@ -2201,10 +2146,10 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) llvm::createModuleToFunctionPassAdaptor(std::move(fpm))); } -# if OSL_LLVM_VERSION < 150 +#if OSL_LLVM_VERSION < 150 mpm.addPass(llvm::createModuleToPostOrderCGSCCPassAdaptor( llvm::ArgumentPromotionPass())); -# endif +#endif { llvm::FunctionPassManager fpm; @@ -2212,11 +2157,11 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) fpm.addPass(llvm::InstCombinePass()); fpm.addPass(llvm::JumpThreadingPass()); fpm.addPass(llvm::SimplifyCFGPass()); -# if OSL_LLVM_VERSION < 160 +#if OSL_LLVM_VERSION < 160 fpm.addPass(llvm::SROAPass()); -# else +#else fpm.addPass(llvm::SROAPass(llvm::SROAOptions::PreserveCFG)); -# endif +#endif fpm.addPass(llvm::InstCombinePass()); fpm.addPass(llvm::TailCallElimPass()); mpm.addPass( @@ -2238,18 +2183,18 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) mpm.addPass(llvm::ModuleInlinerWrapperPass()); -# if OSL_LLVM_VERSION < 150 +#if OSL_LLVM_VERSION < 150 mpm.addPass(llvm::createModuleToPostOrderCGSCCPassAdaptor( llvm::ArgumentPromotionPass())); -# endif +#endif { llvm::FunctionPassManager fpm; -# if OSL_LLVM_VERSION < 160 +#if OSL_LLVM_VERSION < 160 fpm.addPass(llvm::SROAPass()); -# else +#else fpm.addPass(llvm::SROAPass(llvm::SROAOptions::PreserveCFG)); -# endif +#endif fpm.addPass(llvm::InstCombinePass()); fpm.addPass(llvm::SimplifyCFGPass()); fpm.addPass(llvm::ReassociatePass()); @@ -2258,7 +2203,11 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) llvm::LoopPassManager lpm; const bool use_memory_ssa = true; // Needed by LICM lpm.addPass(llvm::LoopRotatePass()); +#if OSL_LLVM_VERSION >= 150 lpm.addPass(llvm::LICMPass(llvm::LICMOptions())); +#else + lpm.addPass(llvm::LICMPass()); +#endif lpm.addPass(llvm::SimpleLoopUnswitchPass(false)); fpm.addPass(createFunctionToLoopPassAdaptor(std::move(lpm), use_memory_ssa)); @@ -2332,323 +2281,8 @@ LLVM_Util::setup_new_optimization_passes(int optlevel, bool target_host) }; } } -#endif } -void -LLVM_Util::setup_legacy_optimization_passes(int optlevel, bool target_host) -{ -#ifndef OSL_LLVM_NEW_PASS_MANAGER -# if OSL_LLVM_VERSION >= 160 -# error "Legacy pass manager not supported in LLVM 16 and newer" -# endif - - OSL_DEV_ONLY(std::cout << "setup_legacy_optimization_passes " << optlevel); - OSL_DASSERT(m_llvm_module_passes == NULL && m_llvm_func_passes == NULL); - - // Construct the per-function passes and module-wide (interprocedural - // optimization) passes. - - m_llvm_func_passes = new llvm::legacy::FunctionPassManager(module()); - llvm::legacy::FunctionPassManager& fpm = (*m_llvm_func_passes); - - m_llvm_module_passes = new llvm::legacy::PassManager; - llvm::legacy::PassManager& mpm = (*m_llvm_module_passes); - - llvm::TargetMachine* target_machine = nullptr; - if (target_host) { - target_machine = execengine()->getTargetMachine(); - llvm::Triple ModuleTriple(module()->getTargetTriple()); - // Add an appropriate TargetLibraryInfo pass for the module's triple. - llvm::TargetLibraryInfoImpl TLII(ModuleTriple); - mpm.add(new llvm::TargetLibraryInfoWrapperPass(TLII)); - mpm.add(createTargetTransformInfoWrapperPass( - target_machine ? target_machine->getTargetIRAnalysis() - : llvm::TargetIRAnalysis())); - fpm.add(createTargetTransformInfoWrapperPass( - target_machine ? target_machine->getTargetIRAnalysis() - : llvm::TargetIRAnalysis())); - } - - // llvm_optimize 0-3 corresponds to the same set of optimizations - // as clang: -O0, -O1, -O2, -O3 - // Tests on production shaders suggest the sweet spot between JIT time - // and runtime performance is O1. - // - // Optlevels 10, 11, 12, 13 explicitly create optimization passes. They - // are stripped down versions of clang's -O0, -O1, -O2, -O3. They try to - // provide similar results with improved optimization time by removing - // some expensive passes that were repeated many times and omitting - // other passes that are not applicable or not profitable. Useful for - // debugging, optlevel 10 adds next to no additional passes. - switch (optlevel) { - default: { - // For LLVM 3.0 and higher, llvm_optimize 1-3 means to use the - // same set of optimizations as clang -O1, -O2, -O3 - llvm::PassManagerBuilder builder; - builder.OptLevel = optlevel; - // Time spent in JIT is considerably higher if there is no inliner specified - builder.Inliner = llvm::createFunctionInliningPass(); - builder.DisableUnrollLoops = false; - builder.SLPVectorize = false; - builder.LoopVectorize = false; - if (target_machine) - target_machine->adjustPassManager(builder); - - builder.populateFunctionPassManager(fpm); - builder.populateModulePassManager(mpm); - break; - } - case 10: - // truly add no optimizations - break; - case 11: { - // The least we would want to do - mpm.add(llvm::createFunctionInliningPass()); - mpm.add(llvm::createCFGSimplificationPass()); - mpm.add(llvm::createGlobalDCEPass()); - break; - } - case 12: { -# if 0 // PRETTY_GOOD_KEEP_AS_REF - mpm.add(llvm::createFunctionInliningPass()); - mpm.add(llvm::createCFGSimplificationPass()); - mpm.add(llvm::createGlobalDCEPass()); - - mpm.add(llvm::createTypeBasedAAWrapperPass()); - mpm.add(llvm::createBasicAAWrapperPass()); - mpm.add(llvm::createCFGSimplificationPass()); - mpm.add(llvm::createSROAPass()); - mpm.add(llvm::createEarlyCSEPass()); - - mpm.add(llvm::createReassociatePass()); - mpm.add(llvm::createConstantPropagationPass()); - mpm.add(llvm::createDeadCodeEliminationPass()); - mpm.add(llvm::createCFGSimplificationPass()); - - mpm.add(llvm::createPromoteMemoryToRegisterPass()); - mpm.add(llvm::createAggressiveDCEPass()); - - mpm.add(llvm::createInstructionCombiningPass()); - mpm.add(llvm::createDeadCodeEliminationPass()); - - mpm.add(llvm::createJumpThreadingPass()); - mpm.add(llvm::createSROAPass()); - mpm.add(llvm::createInstructionCombiningPass()); - - // Added - mpm.add(llvm::createDeadStoreEliminationPass()); - - mpm.add(llvm::createGlobalDCEPass()); - mpm.add(llvm::createConstantMergePass()); -# else - mpm.add(llvm::createFunctionInliningPass()); - mpm.add(llvm::createCFGSimplificationPass()); - mpm.add(llvm::createGlobalDCEPass()); - - mpm.add(llvm::createTypeBasedAAWrapperPass()); - mpm.add(llvm::createBasicAAWrapperPass()); - mpm.add(llvm::createCFGSimplificationPass()); - mpm.add(llvm::createSROAPass()); - mpm.add(llvm::createEarlyCSEPass()); - - // Eliminate and remove as much as possible up front - mpm.add(llvm::createReassociatePass()); -# if OSL_LLVM_VERSION < 120 - mpm.add(llvm::createConstantPropagationPass()); -# endif - mpm.add(llvm::createDeadCodeEliminationPass()); - mpm.add(llvm::createCFGSimplificationPass()); - - mpm.add(llvm::createPromoteMemoryToRegisterPass()); - mpm.add(llvm::createAggressiveDCEPass()); - - // mpm.add(llvm::createInstructionCombiningPass()); - mpm.add(llvm::createCFGSimplificationPass()); - mpm.add(llvm::createReassociatePass()); - // TODO: investigate if the loop optimization passes rely on metadata from clang - // we might need to recreate that meta data in OSL's loop code to enable these passes - mpm.add(llvm::createLoopRotatePass()); - mpm.add(llvm::createLICMPass()); -# if OSL_LLVM_VERSION < 150 - mpm.add(llvm::createLoopUnswitchPass(false)); -# endif - // mpm.add(llvm::createInstructionCombiningPass()); - mpm.add(llvm::createIndVarSimplifyPass()); - // Don't think we emitted any idioms that should be converted to a loop - // mpm.add(llvm::createLoopIdiomPass()); - mpm.add(llvm::createLoopDeletionPass()); - mpm.add(llvm::createLoopUnrollPass()); - // GVN is expensive but should pay for itself in reducing JIT time - mpm.add(llvm::createGVNPass()); - - - mpm.add(llvm::createSCCPPass()); - // mpm.add(llvm::createInstructionCombiningPass()); - // JumpThreading combo had a good improvement on JIT time - mpm.add(llvm::createJumpThreadingPass()); - // optional, didn't seem to help more than it cost - // mpm.add(llvm::createCorrelatedValuePropagationPass()); - mpm.add(llvm::createDeadStoreEliminationPass()); - mpm.add(llvm::createAggressiveDCEPass()); - mpm.add(llvm::createCFGSimplificationPass()); - // Place late as possible to minimize #instrs it has to process - mpm.add(llvm::createInstructionCombiningPass()); - - mpm.add(llvm::createPromoteMemoryToRegisterPass()); - mpm.add(llvm::createDeadCodeEliminationPass()); - - mpm.add(llvm::createGlobalDCEPass()); - mpm.add(llvm::createConstantMergePass()); -# endif - break; - } - case 13: { - mpm.add(llvm::createGlobalDCEPass()); - - mpm.add(llvm::createTypeBasedAAWrapperPass()); - mpm.add(llvm::createBasicAAWrapperPass()); - mpm.add(llvm::createCFGSimplificationPass()); - mpm.add(llvm::createSROAPass()); - mpm.add(llvm::createEarlyCSEPass()); - mpm.add(llvm::createLowerExpectIntrinsicPass()); - - mpm.add(llvm::createReassociatePass()); -# if OSL_LLVM_VERSION < 120 - mpm.add(llvm::createConstantPropagationPass()); -# endif - mpm.add(llvm::createDeadCodeEliminationPass()); - mpm.add(llvm::createCFGSimplificationPass()); - - mpm.add(llvm::createPromoteMemoryToRegisterPass()); - mpm.add(llvm::createAggressiveDCEPass()); - - // The InstructionCombining is much more expensive that all the other - // optimizations, should attempt to reduce the number of times it is - // executed, if at all - mpm.add(llvm::createInstructionCombiningPass()); - mpm.add(llvm::createDeadCodeEliminationPass()); - - mpm.add(llvm::createSROAPass()); - mpm.add(llvm::createInstructionCombiningPass()); - mpm.add(llvm::createCFGSimplificationPass()); - mpm.add(llvm::createPromoteMemoryToRegisterPass()); - mpm.add(llvm::createGlobalOptimizerPass()); - mpm.add(llvm::createReassociatePass()); -# if OSL_LLVM_VERSION < 120 - mpm.add(llvm::createIPConstantPropagationPass()); -# else - // createIPConstantPropagationPass disappeared with LLVM 12. - // Comments in their PR indicate that IPSCCP is better, but I don't - // know if that means such a pass should be *right here*. I leave it - // to others who use opt==13 to continue to curate this particular - // list of passes. - mpm.add(llvm::createIPSCCPPass()); -# endif - - mpm.add(llvm::createDeadArgEliminationPass()); - mpm.add(llvm::createInstructionCombiningPass()); - mpm.add(llvm::createCFGSimplificationPass()); - mpm.add(llvm::createPruneEHPass()); - mpm.add(llvm::createPostOrderFunctionAttrsLegacyPass()); - mpm.add(llvm::createReversePostOrderFunctionAttrsPass()); - mpm.add(llvm::createFunctionInliningPass()); -# if OSL_LLVM_VERSION < 120 - mpm.add(llvm::createConstantPropagationPass()); -# endif - mpm.add(llvm::createDeadCodeEliminationPass()); - mpm.add(llvm::createCFGSimplificationPass()); - -# if OSL_LLVM_VERSION < 150 - mpm.add(llvm::createArgumentPromotionPass()); -# endif - mpm.add(llvm::createAggressiveDCEPass()); - mpm.add(llvm::createInstructionCombiningPass()); - mpm.add(llvm::createJumpThreadingPass()); - mpm.add(llvm::createCFGSimplificationPass()); - mpm.add(llvm::createSROAPass()); - mpm.add(llvm::createInstructionCombiningPass()); - mpm.add(llvm::createTailCallEliminationPass()); - - mpm.add(llvm::createFunctionInliningPass()); -# if OSL_LLVM_VERSION < 120 - mpm.add(llvm::createConstantPropagationPass()); -# endif - - mpm.add(llvm::createIPSCCPPass()); - mpm.add(llvm::createDeadArgEliminationPass()); - mpm.add(llvm::createAggressiveDCEPass()); - mpm.add(llvm::createInstructionCombiningPass()); - mpm.add(llvm::createCFGSimplificationPass()); - - mpm.add(llvm::createFunctionInliningPass()); -# if OSL_LLVM_VERSION < 150 - mpm.add(llvm::createArgumentPromotionPass()); -# endif - mpm.add(llvm::createSROAPass()); - - mpm.add(llvm::createInstructionCombiningPass()); - mpm.add(llvm::createCFGSimplificationPass()); - mpm.add(llvm::createReassociatePass()); - mpm.add(llvm::createLoopRotatePass()); - mpm.add(llvm::createLICMPass()); -# if OSL_LLVM_VERSION < 150 - mpm.add(llvm::createLoopUnswitchPass(false)); -# endif - mpm.add(llvm::createInstructionCombiningPass()); - mpm.add(llvm::createIndVarSimplifyPass()); - mpm.add(llvm::createLoopIdiomPass()); - mpm.add(llvm::createLoopDeletionPass()); - mpm.add(llvm::createLoopUnrollPass()); - mpm.add(llvm::createGVNPass()); - - mpm.add(llvm::createMemCpyOptPass()); - mpm.add(llvm::createSCCPPass()); - mpm.add(llvm::createInstructionCombiningPass()); - mpm.add(llvm::createJumpThreadingPass()); - mpm.add(llvm::createCorrelatedValuePropagationPass()); - mpm.add(llvm::createDeadStoreEliminationPass()); - mpm.add(llvm::createAggressiveDCEPass()); - mpm.add(llvm::createCFGSimplificationPass()); - mpm.add(llvm::createInstructionCombiningPass()); - - mpm.add(llvm::createFunctionInliningPass()); - mpm.add(llvm::createAggressiveDCEPass()); - mpm.add(llvm::createStripDeadPrototypesPass()); - mpm.add(llvm::createGlobalDCEPass()); - mpm.add(llvm::createConstantMergePass()); - mpm.add(llvm::createVerifierPass()); - break; - } - }; // switch(optlevel) - - // Add some extra passes if they are needed - if (target_host) { - if (!m_supports_llvm_bit_masks_natively) { - switch (m_vector_width) { - case 16: - // MUST BE THE FINAL PASS! - mpm.add( - new LegacyPreventBitMasksFromBeingLiveinsToBasicBlocks<16>()); - break; - case 8: - // MUST BE THE FINAL PASS! - mpm.add( - new LegacyPreventBitMasksFromBeingLiveinsToBasicBlocks<8>()); - break; - case 4: - // MUST BE THE FINAL PASS! - mpm.add( - new LegacyPreventBitMasksFromBeingLiveinsToBasicBlocks<4>()); - break; - default: - std::cout << "m_vector_width = " << m_vector_width << "\n"; - OSL_ASSERT(0 && "unsupported bit mask width"); - }; - } - } -#endif -} void @@ -2662,19 +2296,9 @@ LLVM_Util::do_optimize(std::string* out_err) return; #endif -#ifdef OSL_LLVM_NEW_PASS_MANAGER // New pass manager m_new_pass_manager->module_pass_manager.run( *m_llvm_module, m_new_pass_manager->module_analysis_manager); -#else - // Legacy pass manager - m_llvm_func_passes->doInitialization(); - for (auto&& I : m_llvm_module->functions()) - if (!I.isDeclaration()) - m_llvm_func_passes->run(I); - m_llvm_func_passes->doFinalization(); - m_llvm_module_passes->run(*m_llvm_module); -#endif } @@ -4492,13 +4116,6 @@ llvm::Value* LLVM_Util::op_load(llvm::Type* type, llvm::Value* ptr, const std::string& llname) { -#ifndef OSL_LLVM_OPAQUE_POINTERS - OSL_PRAGMA_WARNING_PUSH - OSL_GCC_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations") - OSL_ASSERT(type - == ptr->getType()->getScalarType()->getPointerElementType()); - OSL_PRAGMA_WARNING_POP -#endif return builder().CreateLoad(type, ptr, llname); } @@ -6168,13 +5785,6 @@ llvm::Value* LLVM_Util::GEP(llvm::Type* type, llvm::Value* ptr, llvm::Value* elem, const std::string& llname) { -#ifndef OSL_LLVM_OPAQUE_POINTERS - OSL_PRAGMA_WARNING_PUSH - OSL_GCC_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations") - OSL_ASSERT(type - == ptr->getType()->getScalarType()->getPointerElementType()); - OSL_PRAGMA_WARNING_POP -#endif return builder().CreateGEP(type, ptr, elem, llname); } @@ -6184,13 +5794,6 @@ llvm::Value* LLVM_Util::GEP(llvm::Type* type, llvm::Value* ptr, int elem, const std::string& llname) { -#ifndef OSL_LLVM_OPAQUE_POINTERS - OSL_PRAGMA_WARNING_PUSH - OSL_GCC_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations") - OSL_ASSERT(type - == ptr->getType()->getScalarType()->getPointerElementType()); - OSL_PRAGMA_WARNING_POP -#endif return builder().CreateConstGEP1_32(type, ptr, elem, llname); } @@ -6200,13 +5803,6 @@ llvm::Value* LLVM_Util::GEP(llvm::Type* type, llvm::Value* ptr, int elem1, int elem2, const std::string& llname) { -#ifndef OSL_LLVM_OPAQUE_POINTERS - OSL_PRAGMA_WARNING_PUSH - OSL_GCC_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations") - OSL_ASSERT(type - == ptr->getType()->getScalarType()->getPointerElementType()); - OSL_PRAGMA_WARNING_POP -#endif return builder().CreateConstGEP2_32(type, ptr, elem1, elem2, llname); } @@ -6215,13 +5811,6 @@ llvm::Value* LLVM_Util::GEP(llvm::Type* type, llvm::Value* ptr, int elem1, int elem2, int elem3, const std::string& llname) { -#ifndef OSL_LLVM_OPAQUE_POINTERS - OSL_PRAGMA_WARNING_PUSH - OSL_GCC_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations") - OSL_ASSERT(type - == ptr->getType()->getScalarType()->getPointerElementType()); - OSL_PRAGMA_WARNING_POP -#endif llvm::Value* elements[3] = { constant(elem1), constant(elem2), constant(elem3) }; return builder().CreateGEP(type, ptr, toArrayRef(elements), llname);