raven-rhel8/extras/mesa/0001-fix-build-with-LLVM-19.patch
2024-10-24 17:57:27 +06:00

72 lines
2.5 KiB
Diff

diff -Naur a/src/compiler/clc/clc_helpers.cpp b/src/compiler/clc/clc_helpers.cpp
--- a/src/compiler/clc/clc_helpers.cpp 2024-10-14 15:16:10.908581118 +0600
+++ b/src/compiler/clc/clc_helpers.cpp 2024-10-14 15:17:22.924120115 +0600
@@ -85,13 +85,21 @@
using ::clang::driver::Driver;
static void
+#if LLVM_VERSION_MAJOR >= 19
+llvm_log_handler(const ::llvm::DiagnosticInfo *di, void *data) {
+#else
llvm_log_handler(const ::llvm::DiagnosticInfo &di, void *data) {
+#endif
const clc_logger *logger = static_cast<clc_logger *>(data);
std::string log;
raw_string_ostream os { log };
::llvm::DiagnosticPrinterRawOStream printer { os };
+#if LLVM_VERSION_MAJOR >= 19
+ di->print(printer);
+#else
di.print(printer);
+#endif
clc_error(logger, "%s", log.c_str());
}
diff -Naur a/src/gallium/frontends/clover/llvm/invocation.cpp b/src/gallium/frontends/clover/llvm/invocation.cpp
--- a/src/gallium/frontends/clover/llvm/invocation.cpp 2024-10-14 15:20:16.317010149 +0600
+++ b/src/gallium/frontends/clover/llvm/invocation.cpp 2024-10-14 15:21:13.420644604 +0600
@@ -128,11 +128,20 @@
}
void
+#if LLVM_VERSION_MAJOR >= 19
+ diagnostic_handler(const ::llvm::DiagnosticInfo *di, void *data) {
+ if (di->getSeverity() == ::llvm::DS_Error) {
+#else
diagnostic_handler(const ::llvm::DiagnosticInfo &di, void *data) {
if (di.getSeverity() == ::llvm::DS_Error) {
+#endif
raw_string_ostream os { *reinterpret_cast<std::string *>(data) };
::llvm::DiagnosticPrinterRawOStream printer { os };
+#if LLVM_VERSION_MAJOR >= 19
+ di->print(printer);
+#else
di.print(printer);
+#endif
throw build_error();
}
}
diff -Naur a/src/amd/llvm/ac_llvm_helper.cpp b/src/amd/llvm/ac_llvm_helper.cpp
--- a/src/amd/llvm/ac_llvm_helper.cpp
+++ b/src/amd/llvm/ac_llvm_helper.cpp
@@ -8,6 +8,7 @@
#include <llvm/Analysis/TargetLibraryInfo.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/LegacyPassManager.h>
+#include <llvm/IR/Module.h>
#include <llvm/IR/Verifier.h>
#include <llvm/Target/TargetMachine.h>
#include <llvm/MC/MCSubtargetInfo.h>
@@ -307,8 +307,9 @@
unwrap(passmgr)->add(createSROAPass());
#endif
/* TODO: restore IPSCCP */
- if (LLVM_VERSION_MAJOR >= 16)
+ #if LLVM_VERSION_MAJOR >= 16 && LLVM_VERSION_MAJOR < 18
unwrap(passmgr)->add(createLoopSinkPass());
+ #endif
/* TODO: restore IPSCCP */
unwrap(passmgr)->add(createLICMPass());
unwrap(passmgr)->add(createCFGSimplificationPass());