From ad81baa4f5016f585e303cf373e347379368406c Mon Sep 17 00:00:00 2001 From: Anuj Mittal Date: Thu, 15 Sep 2022 21:53:09 +0800 Subject: ispc: fix build with LLVM 15 Backport patches to fix build with LLVM 15 which is now the default version in meta-clang master. Signed-off-by: Anuj Mittal diff --git a/dynamic-layers/clang-layer/recipes-core/ispc/ispc/6a1b2ffae0cc12467838bc671e3b089924de90a6.patch b/dynamic-layers/clang-layer/recipes-core/ispc/ispc/6a1b2ffae0cc12467838bc671e3b089924de90a6.patch new file mode 100644 index 0000000..6aac0c7 --- /dev/null +++ b/dynamic-layers/clang-layer/recipes-core/ispc/ispc/6a1b2ffae0cc12467838bc671e3b089924de90a6.patch @@ -0,0 +1,33 @@ +From 6a1b2ffae0cc12467838bc671e3b089924de90a6 Mon Sep 17 00:00:00 2001 +From: Dmitry Babokin +Date: Thu, 5 May 2022 16:34:34 -0700 +Subject: [PATCH] Bump ISPC version v1.19.0dev + +Upstream-Status: Backport + +Include only the LLVM specific bits and not the ispc version bump. + +Signed-off-by: Anuj Mittal +--- +diff --git a/src/ispc_version.h b/src/ispc_version.h +index 0e28dfcfa..2b9d9b0cc 100644 +--- a/src/ispc_version.h ++++ b/src/ispc_version.h +@@ -51,7 +51,7 @@ + #define ISPC_LLVM_15_0 150000 + + #define OLDEST_SUPPORTED_LLVM ISPC_LLVM_10_0 +-#define LATEST_SUPPORTED_LLVM ISPC_LLVM_14_0 ++#define LATEST_SUPPORTED_LLVM ISPC_LLVM_15_0 + + #ifdef __ispc__xstr + #undef __ispc__xstr +@@ -63,7 +63,7 @@ + __ispc__xstr(LLVM_VERSION_MAJOR) "." __ispc__xstr(LLVM_VERSION_MINOR) "." __ispc__xstr(LLVM_VERSION_PATCH) + + #if ISPC_LLVM_VERSION < OLDEST_SUPPORTED_LLVM || ISPC_LLVM_VERSION > LATEST_SUPPORTED_LLVM +-#error "Only LLVM 11.0 - 14.0 are supported" ++#error "Only LLVM 11.0 - 14.0 and 15.0 development branch are supported" + #endif + + #define ISPC_VERSION_STRING \ diff --git a/dynamic-layers/clang-layer/recipes-core/ispc/ispc/ec35a6f8e60ba77e59a6f2bfec27011e0ab34dda.patch b/dynamic-layers/clang-layer/recipes-core/ispc/ispc/ec35a6f8e60ba77e59a6f2bfec27011e0ab34dda.patch new file mode 100644 index 0000000..a5ab8c1 --- /dev/null +++ b/dynamic-layers/clang-layer/recipes-core/ispc/ispc/ec35a6f8e60ba77e59a6f2bfec27011e0ab34dda.patch @@ -0,0 +1,63 @@ +From ec35a6f8e60ba77e59a6f2bfec27011e0ab34dda Mon Sep 17 00:00:00 2001 +From: Arina Neshlyaeva +Date: Tue, 23 Aug 2022 15:21:50 -0700 +Subject: [PATCH] Adjust opt passes for LLVM 15 + +Upstream-Status: Backport +Signed-off-by: Anuj Mittal +--- + src/opt.cpp | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/src/opt.cpp b/src/opt.cpp +index 910821e26..86219f384 100644 +--- a/src/opt.cpp ++++ b/src/opt.cpp +@@ -84,6 +84,9 @@ + #include + #include + #include ++#if ISPC_LLVM_VERSION >= ISPC_LLVM_15_0 ++#include ++#endif + #include + #include + +@@ -647,7 +650,11 @@ void ispc::Optimize(llvm::Module *module, int optLevel) { + optPM.add(llvm::createCFGSimplificationPass()); + #endif + ++#if ISPC_LLVM_VERSION < ISPC_LLVM_15_0 ++ // Starting LLVM 15.0 this pass is supported with new pass manager only (217e857) ++ // TODO: switch ISPC to new pass manager: https://github.com/ispc/ispc/issues/2359 + optPM.add(llvm::createArgumentPromotionPass()); ++#endif + + optPM.add(llvm::createAggressiveDCEPass()); + optPM.add(llvm::createInstructionCombiningPass(), 241); +@@ -722,7 +729,11 @@ void ispc::Optimize(llvm::Module *module, int optLevel) { + optPM.add(CreateInstructionSimplifyPass()); + + optPM.add(llvm::createFunctionInliningPass()); ++#if ISPC_LLVM_VERSION < ISPC_LLVM_15_0 ++ // Starting LLVM 15.0 this pass is supported with new pass manager only (217e857) ++ // TODO: switch ISPC to new pass manager: https://github.com/ispc/ispc/issues/2359 + optPM.add(llvm::createArgumentPromotionPass()); ++#endif + + optPM.add(llvm::createSROAPass()); + +@@ -736,7 +747,13 @@ void ispc::Optimize(llvm::Module *module, int optLevel) { + optPM.add(llvm::createReassociatePass()); + optPM.add(llvm::createLoopRotatePass()); + optPM.add(llvm::createLICMPass()); ++ // Loop unswitch pass was removed in LLVM 15.0 (fb4113). ++ // Recommended replacement: createSimpleLoopUnswitchLegacyPass ++#if ISPC_LLVM_VERSION < ISPC_LLVM_15_0 + optPM.add(llvm::createLoopUnswitchPass(false)); ++#else ++ optPM.add(llvm::createSimpleLoopUnswitchLegacyPass(false)); ++#endif + optPM.add(llvm::createInstructionCombiningPass()); + optPM.add(CreateInstructionSimplifyPass()); + optPM.add(llvm::createIndVarSimplifyPass()); diff --git a/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.18.0.bb b/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.18.0.bb index db67417..24b0988 100644 --- a/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.18.0.bb +++ b/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.18.0.bb @@ -15,6 +15,8 @@ SRC_URI = "git://github.com/ispc/ispc.git;protocol=https;branch=main \ file://0001-CMakeLists.txt-link-with-libclang-cpp-library-instea.patch \ file://0002-cmake-don-t-build-for-32-bit-targets.patch \ file://0001-Fix-QA-Issues.patch \ + file://6a1b2ffae0cc12467838bc671e3b089924de90a6.patch \ + file://ec35a6f8e60ba77e59a6f2bfec27011e0ab34dda.patch \ " SRCREV = "f7ec3aa173c816377c215d83196b5c7c3a88db1c" -- cgit v0.10.2-6-g49f6