summaryrefslogtreecommitdiffstats
path: root/patches
diff options
context:
space:
mode:
authorroot <root@gocchin.haxx.dafuq>2021-11-20 02:21:01 -0600
committerroot <root@gocchin.haxx.dafuq>2021-11-20 02:21:01 -0600
commitf7bb8734a2cdde9dbbee2b0080f89150861b5b58 (patch)
treeaee467459c02e7717de933badb165c11aa21ad1f /patches
parent5d4532f601cb9225bbc911a13bedbb48c0499686 (diff)
downloadgentoox-f7bb8734a2cdde9dbbee2b0080f89150861b5b58.tar.gz
gentoox-f7bb8734a2cdde9dbbee2b0080f89150861b5b58.tar.bz2
gentoox-f7bb8734a2cdde9dbbee2b0080f89150861b5b58.zip
update patches
Diffstat (limited to 'patches')
-rw-r--r--patches/app-emulation/virtualbox-guest-additions/020-linux-5-11.patch12
-rw-r--r--patches/dev-lang/ispc/llvm13.patch11
-rw-r--r--patches/dev-qt/qtwebengine/qt5-webengine-glibc-2.33.patch144
-rw-r--r--patches/media-libs/osl/8682211d0bfe5c4be63a4a003d06037ff9721e66.patch48
-rw-r--r--patches/media-libs/osl/bf02d4a98b284e865cda0422dcd5bef2cdc4d662.patch167
-rw-r--r--patches/sys-devel/llvm/disable-bswap-for-spir.patch50
6 files changed, 276 insertions, 156 deletions
diff --git a/patches/app-emulation/virtualbox-guest-additions/020-linux-5-11.patch b/patches/app-emulation/virtualbox-guest-additions/020-linux-5-11.patch
deleted file mode 100644
index 66b70bf..0000000
--- a/patches/app-emulation/virtualbox-guest-additions/020-linux-5-11.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c b/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
-index 7033b45..c8178a6 100644
---- a/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
-+++ b/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
-@@ -39,6 +39,7 @@
- #endif
- #include <linux/netdevice.h>
- #include <linux/etherdevice.h>
-+#include <linux/ethtool.h>
- #include <linux/rtnetlink.h>
- #include <linux/miscdevice.h>
- #include <linux/inetdevice.h>
diff --git a/patches/dev-lang/ispc/llvm13.patch b/patches/dev-lang/ispc/llvm13.patch
new file mode 100644
index 0000000..daf72b5
--- /dev/null
+++ b/patches/dev-lang/ispc/llvm13.patch
@@ -0,0 +1,11 @@
+--- a/src/module.cpp 2021-07-15 18:04:31.000000000 -0500
++++ b/src/module.cpp 2021-11-20 00:45:28.168852687 -0600
+@@ -1314,7 +1314,7 @@
+ llvm::CodeGenFileType fileType = (outputType == Object) ? llvm::CGFT_ObjectFile : llvm::CGFT_AssemblyFile;
+ bool binary = (fileType == llvm::CGFT_ObjectFile);
+
+- llvm::sys::fs::OpenFlags flags = binary ? llvm::sys::fs::F_None : llvm::sys::fs::F_Text;
++ llvm::sys::fs::OpenFlags flags = binary ? llvm::sys::fs::OF_None : llvm::sys::fs::OF_Text;
+
+ std::error_code error;
+
diff --git a/patches/dev-qt/qtwebengine/qt5-webengine-glibc-2.33.patch b/patches/dev-qt/qtwebengine/qt5-webengine-glibc-2.33.patch
deleted file mode 100644
index 3a0ba3b..0000000
--- a/patches/dev-qt/qtwebengine/qt5-webengine-glibc-2.33.patch
+++ /dev/null
@@ -1,144 +0,0 @@
-# Patch made by Kevin Kofler <Kevin@tigcc.ticalc.org>
-# https://bugzilla.redhat.com/show_bug.cgi?id=1904652
-
-diff -ur qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc qtwebengine-everywhere-src-5.15.2-#1904652/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
---- qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc 2020-11-07 02:22:36.000000000 +0100
-+++ qtwebengine-everywhere-src-5.15.2-#1904652/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc 2021-01-20 02:14:53.066223906 +0100
-@@ -257,6 +257,18 @@
- return RestrictKillTarget(current_pid, sysno);
- }
-
-+#if defined(__NR_newfstatat)
-+ if (sysno == __NR_newfstatat) {
-+ return RewriteFstatatSIGSYS();
-+ }
-+#endif
-+
-+#if defined(__NR_fstatat64)
-+ if (sysno == __NR_fstatat64) {
-+ return RewriteFstatatSIGSYS();
-+ }
-+#endif
-+
- if (SyscallSets::IsFileSystem(sysno) ||
- SyscallSets::IsCurrentDirectory(sysno)) {
- return Error(fs_denied_errno);
-diff -ur qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc qtwebengine-everywhere-src-5.15.2-#1904652/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
---- qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc 2020-11-07 02:22:36.000000000 +0100
-+++ qtwebengine-everywhere-src-5.15.2-#1904652/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc 2021-01-22 19:02:55.651668257 +0100
-@@ -6,6 +6,8 @@
-
- #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h"
-
-+#include <errno.h>
-+#include <fcntl.h>
- #include <stddef.h>
- #include <stdint.h>
- #include <string.h>
-@@ -355,6 +357,35 @@
- return -ENOSYS;
- }
-
-+intptr_t SIGSYSFstatatHandler(const struct arch_seccomp_data& args,
-+ void* aux) {
-+ switch (args.nr) {
-+#if defined(__NR_newfstatat)
-+ case __NR_newfstatat:
-+#endif
-+#if defined(__NR_fstatat64)
-+ case __NR_fstatat64:
-+#endif
-+#if defined(__NR_newfstatat) || defined(__NR_fstatat64)
-+ if (*reinterpret_cast<const char *>(args.args[1]) == '\0'
-+ && args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) {
-+ return sandbox::sys_fstat64(static_cast<int>(args.args[0]),
-+ reinterpret_cast<struct stat64 *>(args.args[2]));
-+ } else {
-+ errno = EACCES;
-+ return -1;
-+ }
-+ break;
-+#endif
-+ }
-+
-+ CrashSIGSYS_Handler(args, aux);
-+
-+ // Should never be reached.
-+ RAW_CHECK(false);
-+ return -ENOSYS;
-+}
-+
- bpf_dsl::ResultExpr CrashSIGSYS() {
- return bpf_dsl::Trap(CrashSIGSYS_Handler, NULL);
- }
-@@ -387,6 +418,10 @@
- return bpf_dsl::Trap(SIGSYSSchedHandler, NULL);
- }
-
-+bpf_dsl::ResultExpr RewriteFstatatSIGSYS() {
-+ return bpf_dsl::Trap(SIGSYSFstatatHandler, NULL);
-+}
-+
- void AllocateCrashKeys() {
- #if !defined(OS_NACL_NONSFI)
- if (seccomp_crash_key)
-diff -ur qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h qtwebengine-everywhere-src-5.15.2-#1904652/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h
---- qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h 2020-11-07 02:22:36.000000000 +0100
-+++ qtwebengine-everywhere-src-5.15.2-#1904652/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h 2021-01-20 02:11:04.583714199 +0100
-@@ -62,6 +62,10 @@
- // sched_setparam(), sched_setscheduler()
- SANDBOX_EXPORT intptr_t SIGSYSSchedHandler(const arch_seccomp_data& args,
- void* aux);
-+// If the fstatat syscall is actually a disguised fstat, calls the regular fstat
-+// syscall, otherwise, crashes in the same way as CrashSIGSYS_Handler.
-+SANDBOX_EXPORT intptr_t SIGSYSFstatatHandler(const struct arch_seccomp_data& args,
-+ void* aux);
-
- // Variants of the above functions for use with bpf_dsl.
- SANDBOX_EXPORT bpf_dsl::ResultExpr CrashSIGSYS();
-@@ -72,6 +76,7 @@
- SANDBOX_EXPORT bpf_dsl::ResultExpr CrashSIGSYSFutex();
- SANDBOX_EXPORT bpf_dsl::ResultExpr CrashSIGSYSPtrace();
- SANDBOX_EXPORT bpf_dsl::ResultExpr RewriteSchedSIGSYS();
-+SANDBOX_EXPORT bpf_dsl::ResultExpr RewriteFstatatSIGSYS();
-
- // Allocates a crash key so that Seccomp information can be recorded.
- void AllocateCrashKeys();
-diff -ur qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/services/syscall_wrappers.cc qtwebengine-everywhere-src-5.15.2-#1904652/src/3rdparty/chromium/sandbox/linux/services/syscall_wrappers.cc
---- qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/services/syscall_wrappers.cc 2020-11-07 02:22:36.000000000 +0100
-+++ qtwebengine-everywhere-src-5.15.2-#1904652/src/3rdparty/chromium/sandbox/linux/services/syscall_wrappers.cc 2021-01-20 02:41:12.033133269 +0100
-@@ -261,4 +261,13 @@
-
- #endif // defined(MEMORY_SANITIZER)
-
-+SANDBOX_EXPORT int sys_fstat64(int fd, struct stat64 *buf)
-+{
-+#if defined(__NR_fstat64)
-+ return syscall(__NR_fstat64, fd, buf);
-+#else
-+ return syscall(__NR_fstat, fd, buf);
-+#endif
-+}
-+
- } // namespace sandbox
-diff -ur qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/services/syscall_wrappers.h qtwebengine-everywhere-src-5.15.2-#1904652/src/3rdparty/chromium/sandbox/linux/services/syscall_wrappers.h
---- qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/sandbox/linux/services/syscall_wrappers.h 2020-11-07 02:22:36.000000000 +0100
-+++ qtwebengine-everywhere-src-5.15.2-#1904652/src/3rdparty/chromium/sandbox/linux/services/syscall_wrappers.h 2021-01-20 02:40:26.499827829 +0100
-@@ -17,6 +17,7 @@
- struct rlimit64;
- struct cap_hdr;
- struct cap_data;
-+struct stat64;
-
- namespace sandbox {
-
-@@ -84,6 +85,9 @@
- const struct sigaction* act,
- struct sigaction* oldact);
-
-+// Recent glibc rewrites fstat to fstatat.
-+SANDBOX_EXPORT int sys_fstat64(int fd, struct stat64 *buf);
-+
- } // namespace sandbox
-
- #endif // SANDBOX_LINUX_SERVICES_SYSCALL_WRAPPERS_H_
diff --git a/patches/media-libs/osl/8682211d0bfe5c4be63a4a003d06037ff9721e66.patch b/patches/media-libs/osl/8682211d0bfe5c4be63a4a003d06037ff9721e66.patch
new file mode 100644
index 0000000..34adf4c
--- /dev/null
+++ b/patches/media-libs/osl/8682211d0bfe5c4be63a4a003d06037ff9721e66.patch
@@ -0,0 +1,48 @@
+From 8682211d0bfe5c4be63a4a003d06037ff9721e66 Mon Sep 17 00:00:00 2001
+From: Luya Tshimbalanga <luya@fedoraproject.org>
+Date: Tue, 28 Sep 2021 10:08:01 -0700
+Subject: [PATCH] Fix compatibility with LLVM 12 and up (#1412)
+
+Upstream LLVM stopped using the compatibility
+spellings of OF_{None,Text,Append} from version 12 and up.
+
+https://reviews.llvm.org/D101650
+
+Signed-off-by: Luya Tshimbalanga <luya@fedoraproject.org>
+---
+ src/liboslexec/llvm_util.cpp | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/liboslexec/llvm_util.cpp b/src/liboslexec/llvm_util.cpp
+index 4bd0dca35..4d0e1752d 100644
+--- a/src/liboslexec/llvm_util.cpp
++++ b/src/liboslexec/llvm_util.cpp
+@@ -1407,7 +1407,9 @@ LLVM_Util::make_jit_execengine (std::string *err,
+
+ 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;
+@@ -5385,7 +5387,7 @@ void
+ LLVM_Util::write_bitcode_file (const char *filename, std::string *err)
+ {
+ std::error_code local_error;
+- llvm::raw_fd_ostream out (filename, local_error, llvm::sys::fs::F_None);
++ llvm::raw_fd_ostream out (filename, local_error, llvm::sys::fs::OF_None);
+ if (! out.has_error()) {
+ llvm::WriteBitcodeToFile (*module(), out);
+ if (err && local_error)
+@@ -5447,7 +5449,9 @@ LLVM_Util::ptx_compile_group (llvm::Module* lib_module, const std::string& name,
+ options.AllowFPOpFusion = llvm::FPOpFusion::Fast;
+ options.NoZerosInBSS = 0;
+ options.GuaranteedTailCallOpt = 0;
++#if OSL_LLVM_VERSION < 120
+ options.StackAlignmentOverride = 0;
++#endif
+ options.UseInitArray = 0;
+
+ llvm::TargetMachine* target_machine = llvm_target->createTargetMachine(
diff --git a/patches/media-libs/osl/bf02d4a98b284e865cda0422dcd5bef2cdc4d662.patch b/patches/media-libs/osl/bf02d4a98b284e865cda0422dcd5bef2cdc4d662.patch
new file mode 100644
index 0000000..9407c28
--- /dev/null
+++ b/patches/media-libs/osl/bf02d4a98b284e865cda0422dcd5bef2cdc4d662.patch
@@ -0,0 +1,167 @@
+From bf02d4a98b284e865cda0422dcd5bef2cdc4d662 Mon Sep 17 00:00:00 2001
+From: Larry Gritz <lg@larrygritz.com>
+Date: Sun, 24 Oct 2021 15:29:08 -0700
+Subject: [PATCH] Changes to work with LLVM 13 (#1420)
+
+And a few places to let it compile with clang 13's new warnings.
+
+Signed-off-by: Larry Gritz <lg@larrygritz.com>
+---
+ src/include/OSL/llvm_util.h | 17 +++++++++--
+ src/liboslexec/llvm_util.cpp | 45 ++++++++++++++++++++++++++----
+ src/liboslexec/runtimeoptimize.cpp | 2 --
+ 4 files changed, 62 insertions(+), 18 deletions(-)
+
+diff --git a/src/include/OSL/llvm_util.h b/src/include/OSL/llvm_util.h
+index fbf091d60..95df9632f 100644
+--- a/src/include/OSL/llvm_util.h
++++ b/src/include/OSL/llvm_util.h
+@@ -802,6 +802,9 @@ class OSLEXECPUBLIC LLVM_Util {
+ llvm::Value *src, int srcalign, int len);
+
+ /// Dereference a pointer: return *ptr
++ /// type is the type of the thing being pointed to.
++ llvm::Value *op_load (llvm::Type* type, llvm::Value *ptr);
++ // Blind pointer version that's deprecated as of LLVM13:
+ llvm::Value *op_load (llvm::Value *ptr);
+
+ llvm::Value *op_gather(llvm::Value *ptr, llvm::Value *index);
+@@ -830,17 +833,25 @@ class OSLEXECPUBLIC LLVM_Util {
+
+ /// Generate a GEP (get element pointer) where the element index is an
+ /// llvm::Value, which can be generated from either a constant or a
+- /// runtime-computed integer element index.
++ /// runtime-computed integer element index. `type` is the type of the data
++ /// we're retrieving.
++ llvm::Value *GEP (llvm::Type* type, llvm::Value *ptr, llvm::Value *elem);
++ // Blind pointer version that's deprecated as of LLVM13:
+ llvm::Value *GEP (llvm::Value *ptr, llvm::Value *elem);
+
+ /// Generate a GEP (get element pointer) with an integer element
+- /// offset.
++ /// offset. `type` is the type of the data we're retrieving.
++ llvm::Value *GEP (llvm::Type* type, llvm::Value *ptr, int elem);
++ // Blind pointer version that's deprecated as of LLVM13:
+ llvm::Value *GEP (llvm::Value *ptr, int elem);
+
+ /// Generate a GEP (get element pointer) with two integer element
+ /// offsets. This is just a special (and common) case of GEP where
+ /// we have a 2-level hierarchy and we have fixed element indices
+- /// that are known at compile time.
++ /// that are known at compile time. `type` is the type of the data we're
++ /// retrieving.
++ llvm::Value *GEP (llvm::Type* type, llvm::Value *ptr, int elem1, int elem2);
++ // Blind pointer version that's deprecated as of LLVM13:
+ llvm::Value *GEP (llvm::Value *ptr, int elem1, int elem2);
+
+ // Arithmetic ops. It auto-detects the type (int vs float).
+diff --git a/src/liboslexec/llvm_util.cpp b/src/liboslexec/llvm_util.cpp
+index 4d0e1752d..a1d31fe4d 100644
+--- a/src/liboslexec/llvm_util.cpp
++++ b/src/liboslexec/llvm_util.cpp
+@@ -3595,10 +3595,18 @@ LLVM_Util::op_memcpy (llvm::Value *dst, int dstalign,
+
+
+
++llvm::Value *
++LLVM_Util::op_load (llvm::Type* type, llvm::Value* ptr)
++{
++ return builder().CreateLoad (type, ptr);
++}
++
++
++
+ llvm::Value *
+ LLVM_Util::op_load (llvm::Value *ptr)
+ {
+- return builder().CreateLoad (ptr);
++ return op_load(ptr->getType()->getPointerElementType(), ptr);
+ }
+
+
+@@ -4883,7 +4891,7 @@ LLVM_Util::op_store (llvm::Value *val, llvm::Value *ptr)
+ // happen and a read+.
+ // TODO: Optimization, if we know this was the final store to
+ // the ptr, we could force a masked store vs. load/blend
+- llvm::Value *previous_value = builder().CreateLoad (ptr);
++ llvm::Value *previous_value = op_load(ptr);
+ if (false == mi.negate) {
+ llvm::Value *blended_value = builder().CreateSelect(mi.mask, val, previous_value);
+ builder().CreateStore(blended_value, ptr);
+@@ -4924,10 +4932,27 @@ LLVM_Util::op_store_mask (llvm::Value *llvm_mask, llvm::Value *native_mask_ptr)
+
+
+
++llvm::Value *
++LLVM_Util::GEP (llvm::Type* type, llvm::Value* ptr, llvm::Value* elem)
++{
++ return builder().CreateGEP(type, ptr, elem);
++}
++
++
++
+ llvm::Value *
+ LLVM_Util::GEP (llvm::Value *ptr, llvm::Value *elem)
+ {
+- return builder().CreateGEP (ptr, elem);
++ return GEP(ptr->getType()->getScalarType()->getPointerElementType(), ptr,
++ elem);
++}
++
++
++
++llvm::Value *
++LLVM_Util::GEP (llvm::Type* type, llvm::Value* ptr, int elem)
++{
++ return builder().CreateConstGEP1_32(type, ptr, elem);
+ }
+
+
+@@ -4935,7 +4960,16 @@ LLVM_Util::GEP (llvm::Value *ptr, llvm::Value *elem)
+ llvm::Value *
+ LLVM_Util::GEP (llvm::Value *ptr, int elem)
+ {
+- return builder().CreateConstGEP1_32 (ptr, elem);
++ return GEP(ptr->getType()->getScalarType()->getPointerElementType(), ptr,
++ elem);
++}
++
++
++
++llvm::Value *
++LLVM_Util::GEP(llvm::Type* type, llvm::Value* ptr, int elem1, int elem2)
++{
++ return builder().CreateConstGEP2_32 (type, ptr, elem1, elem2);
+ }
+
+
+@@ -4943,7 +4977,8 @@ LLVM_Util::GEP (llvm::Value *ptr, int elem)
+ llvm::Value *
+ LLVM_Util::GEP (llvm::Value *ptr, int elem1, int elem2)
+ {
+- return builder().CreateConstGEP2_32 (nullptr, ptr, elem1, elem2);
++ return GEP(ptr->getType()->getScalarType()->getPointerElementType(), ptr,
++ elem1, elem2);
+ }
+
+
+diff --git a/src/liboslexec/runtimeoptimize.cpp b/src/liboslexec/runtimeoptimize.cpp
+index dfe554164..da67c712e 100644
+--- a/src/liboslexec/runtimeoptimize.cpp
++++ b/src/liboslexec/runtimeoptimize.cpp
+@@ -2284,7 +2284,6 @@ RuntimeOptimizer::optimize_instance ()
+ // passes, but we have a hard cutoff just to be sure we don't
+ // ever get into an infinite loop from an unforseen cycle where we
+ // end up inadvertently transforming A => B => A => etc.
+- int totalchanged = 0;
+ int reallydone = 0; // Force a few passes after we think we're done
+ int npasses = shadingsys().opt_passes();
+ for (m_pass = 0; m_pass < npasses; ++m_pass) {
+@@ -2345,7 +2344,6 @@ RuntimeOptimizer::optimize_instance ()
+ // If nothing changed, we're done optimizing. But wait, it may be
+ // that after re-tracking variable lifetimes, we can notice new
+ // optimizations! So force another pass, then we're really done.
+- totalchanged += changed;
+ if (changed < 1) {
+ if (++reallydone > 3)
+ break;
diff --git a/patches/sys-devel/llvm/disable-bswap-for-spir.patch b/patches/sys-devel/llvm/disable-bswap-for-spir.patch
new file mode 100644
index 0000000..1138501
--- /dev/null
+++ b/patches/sys-devel/llvm/disable-bswap-for-spir.patch
@@ -0,0 +1,50 @@
+# Based on https://github.com/ispc/ispc/blob/main/llvm_patches/12_0_disable-A-B-A-B-and-BSWAP-in-InstCombine.patch
+
+diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
+index d01a021bf3f4..bccce825a03d 100644
+--- a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
++++ b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
+@@ -15,6 +15,7 @@
+ #include "llvm/ADT/APInt.h"
+ #include "llvm/ADT/STLExtras.h"
+ #include "llvm/ADT/SmallVector.h"
++#include "llvm/ADT/Triple.h"
+ #include "llvm/Analysis/InstructionSimplify.h"
+ #include "llvm/Analysis/ValueTracking.h"
+ #include "llvm/IR/Constant.h"
+@@ -1369,9 +1370,12 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
+ }
+ }
+
+- // A+B --> A|B iff A and B have no bits set in common.
+- if (haveNoCommonBitsSet(LHS, RHS, DL, &AC, &I, &DT))
+- return BinaryOperator::CreateOr(LHS, RHS);
++ // Disable this transformation for ISPC SPIR-V
++ if (!Triple(I.getModule()->getTargetTriple()).isSPIR()) {
++ // A+B --> A|B iff A and B have no bits set in common.
++ if (haveNoCommonBitsSet(LHS, RHS, DL, &AC, &I, &DT))
++ return BinaryOperator::CreateOr(LHS, RHS);
++ }
+
+ // add (select X 0 (sub n A)) A --> select X A n
+ {
+diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+index 120852c44474..8de55311ce3e 100644
+--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
++++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+@@ -2671,9 +2671,12 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) {
+ if (Instruction *FoldedLogic = foldBinOpIntoSelectOrPhi(I))
+ return FoldedLogic;
+
+- if (Instruction *BitOp = matchBSwapOrBitReverse(I, /*MatchBSwaps*/ true,
+- /*MatchBitReversals*/ true))
+- return BitOp;
++ // Disable this transformation for ISPC SPIR-V
++ if (!Triple(I.getModule()->getTargetTriple()).isSPIR()) {
++ if (Instruction *BitOp = matchBSwapOrBitReverse(I, /*MatchBSwaps*/ true,
++ /*MatchBitReversals*/ true))
++ return BitOp;
++ }
+
+ if (Instruction *Funnel = matchFunnelShift(I, *this))
+ return Funnel;