Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] Llvm13
@ 2022-03-19 20:12 motorto
  2022-03-20  7:58 ` Llvm13 dkwo
                   ` (98 more replies)
  0 siblings, 99 replies; 101+ messages in thread
From: motorto @ 2022-03-19 20:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1065 bytes --]

There is a new pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages llvm13
https://github.com/void-linux/void-packages/pull/36229

Llvm13
This adds LLVM 13 and updates from LLVM 12.

Work-in-progress

The following packages were removed:
 * beignet -- upstream is dead
 * rundird --  has been deprecated by upstream which recommends using dumb_runtime_dir

The following packages were updated or patched:
 * ispc
 * qtcreator
 * river
 * zig

Rebuilt packages:

(rebuilt based on output of:  `xrevshlib libllvm{12,13}` )


* SPIRV-LLVM-Translator
* bcc
* bpftrace 
* ccls 
* clazy 
* codelite 
* ghdl
* gnome-builder
* include-what-you-use 
* juCi++ 
* kdevelop 
* ldc
* mesa 
* qt5 
* rtags 
* rust
* shiboken2 
* tilix

Updated Templates:

* Chromium

(I am probably missing some packages)


Thanks @DBLouis for your hard work! 

 [ci skip]
 
 I nuked the #35895

A patch file from https://github.com/void-linux/void-packages/pull/36229.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm13-36229.patch --]
[-- Type: text/x-diff, Size: 553351 bytes --]

From 2674c9cadde8a758bc182b57ab8bc10974387c49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Fri, 31 Dec 2021 16:21:30 +0200
Subject: [PATCH 01/30] New package: llvm13-13.0.0

---
 common/shlibs                                 |  16 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm13                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm13/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 110 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  13 +
 .../patches/clang-004-ppc64-musl-elfv2.patch  |  48 ++
 .../compiler-rt-aarch64-ucontext.patch        |  11 +
 .../compiler-rt-sanitizer-ppc64-musl.patch    |  35 ++
 .../patches/compiler-rt-xray-ppc64-musl.patch |  62 +++
 srcpkgs/llvm13/patches/libcxx-musl.patch      |  26 ++
 srcpkgs/llvm13/patches/libcxx-ppc.patch       |  22 +
 .../llvm13/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm13/patches/libcxxabi-dl.patch     |  25 ++
 srcpkgs/llvm13/patches/libunwind-ppc32.patch  |  63 +++
 srcpkgs/llvm13/patches/lldb-musl.patch        |  31 ++
 srcpkgs/llvm13/patches/llvm-001-musl.patch    |  57 +++
 .../patches/llvm-002-musl-ppc64-elfv2.patch   |  30 ++
 .../patches/llvm-003-ppc-secureplt.patch      |  11 +
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm13/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../patches/llvm-006-aarch64-mf_exec.patch    |  25 ++
 .../llvm13/patches/ppc32-compiler-rt.patch    |  21 +
 srcpkgs/llvm13/template                       | 423 ++++++++++++++++++
 srcpkgs/llvm13/update                         |   3 +
 42 files changed, 1165 insertions(+), 20 deletions(-)
 create mode 120000 srcpkgs/libllvm13
 create mode 100644 srcpkgs/llvm13/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm13/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm13/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm13/patches/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm13/patches/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm13/patches/compiler-rt-aarch64-ucontext.patch
 create mode 100644 srcpkgs/llvm13/patches/compiler-rt-sanitizer-ppc64-musl.patch
 create mode 100644 srcpkgs/llvm13/patches/compiler-rt-xray-ppc64-musl.patch
 create mode 100644 srcpkgs/llvm13/patches/libcxx-musl.patch
 create mode 100644 srcpkgs/llvm13/patches/libcxx-ppc.patch
 create mode 100644 srcpkgs/llvm13/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm13/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm13/patches/libunwind-ppc32.patch
 create mode 100644 srcpkgs/llvm13/patches/lldb-musl.patch
 create mode 100644 srcpkgs/llvm13/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm13/patches/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm13/patches/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm13/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm13/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm13/patches/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm13/patches/ppc32-compiler-rt.patch
 create mode 100644 srcpkgs/llvm13/template
 create mode 100644 srcpkgs/llvm13/update

diff --git a/common/shlibs b/common/shlibs
index 83b5783cb026..1a5eb573aefb 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -973,11 +973,12 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.12 lldb-12.0.0_1
-libclang.so.12 libclang-12.0.0_1
-libclang-cpp.so.12 libclang-cpp-12.0.0_1
+liblldb.so.13 lldb-13.0.0_1
+libclang.so.13 libclang-13.0.0_1
+libclang-cpp.so.13 libclang-cpp-13.0.0_1
 libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
+libLLVM-13.so libllvm13-13.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
@@ -4142,3 +4143,12 @@ librz_util.so.0.3.4 rizin-0.3.4_1
 librz_lang.so.0.3.4 rizin-0.3.4_1
 librz_search.so.0.3.4 rizin-0.3.4_1
 librz_bin.so.0.3.4 rizin-0.3.4_1
+libomp.so libomp-13.0.0_1
+libomptarget.rtl.amdgpu.so libomp-13.0.0_1
+libomptarget.rtl.cuda.so libomp-13.0.0_1
+libomptarget.rtl.x86_64.so libomp-13.0.0_1
+libarcher.so libomp-13.0.0_1
+libomptarget.so libomp-13.0.0_1
+liblldbIntelFeatures.so.13 lldb-13.0.0_1
+libLTO.so.13 llvm13-13.0.0_1
+libRemarks.so.13 llvm13-13.0.0_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libllvm13 b/srcpkgs/libllvm13
new file mode 120000
index 000000000000..d6366d7d3b95
--- /dev/null
+++ b/srcpkgs/libllvm13
@@ -0,0 +1 @@
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/llvm13/files/llvm-Config-llvm-config.h b/srcpkgs/llvm13/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm13/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm13/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm13/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm13/patches/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/clang/lib/Headers/unwind.h
++++ b/clang/lib/Headers/unwind.h
+@@ -9,9 +9,6 @@
+ 
+ /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
+ 
+-#ifndef __CLANG_UNWIND_H
+-#define __CLANG_UNWIND_H
+-
+ #if defined(__APPLE__) && __has_include_next(<unwind.h>)
+ /* Darwin (from 11.x on) provide an unwind.h. If that's available,
+  * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm13/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm13/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..25688d40dbc2
--- /dev/null
+++ b/srcpkgs/llvm13/patches/clang-002-add-musl-triples.patch
@@ -0,0 +1,110 @@
+--- a/clang/lib/Driver/ToolChains/Gnu.cpp
++++ b/clang/lib/Driver/ToolChains/Gnu.cpp
+@@ -2086,7 +2086,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2153,8 +2154,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+       "powerpc64-suse-linux", "powerpc-montavista-linuxspe"};
+   static const char *const PPCLELibDirs[] = {"/lib32", "/lib"};
+   static const char *const PPCLETriples[] = {"powerpcle-linux-gnu",
+-                                             "powerpcle-unknown-linux-gnu",
+-                                             "powerpcle-linux-musl"};
++                                             "powerpcle-unknown-linux-gnu"};
+ 
+   static const char *const PPC64LibDirs[] = {"/lib64", "/lib"};
+   static const char *const PPC64Triples[] = {
+@@ -2235,6 +2235,87 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPCLEMuslTriples[] = {"powerpcle-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppcle:
++      LibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
++      TripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      BiarchTripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      BiarchLibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
++      BiarchTripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm13/patches/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm13/patches/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 000000000000..4ad6412d1e6c
--- /dev/null
+++ b/srcpkgs/llvm13/patches/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,13 @@
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -504,10 +504,6 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
+-    Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
+-    break;
+   case llvm::Triple::ppc64le:
+     LibDir = "lib64";
+     Loader =
diff --git a/srcpkgs/llvm13/patches/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm13/patches/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 000000000000..21fc8003c5f1
--- /dev/null
+++ b/srcpkgs/llvm13/patches/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,48 @@
+--- a/clang/lib/Basic/Targets/PPC.h
++++ b/clang/lib/Basic/Targets/PPC.h
+@@ -415,11 +415,10 @@ public:
+       LongDoubleFormat = &llvm::APFloat::IEEEdouble();
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       DataLayout = "e-m:e-i64:64-n32:64";
+-      ABI = "elfv2";
+     } else {
+       DataLayout = "E-m:e-i64:64-n32:64";
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+ 
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) {
+       LongDoubleWidth = LongDoubleAlign = 64;
+--- a/clang/lib/CodeGen/TargetInfo.cpp
++++ b/clang/lib/CodeGen/TargetInfo.cpp
+@@ -10927,9 +10927,9 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
+       return SetCGInfo(new AIXTargetCodeGenInfo(Types, /*Is64Bit*/ true));
+ 
+     if (Triple.isOSBinFormatELF()) {
+-      PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv1;
+-      if (getTarget().getABI() == "elfv2")
+-        Kind = PPC64_SVR4_ABIInfo::ELFv2;
++      PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv2;
++      if (getTarget().getABI() == "elfv1")
++        Kind = PPC64_SVR4_ABIInfo::ELFv1;
+       bool IsSoftFloat = CodeGenOpts.FloatABI == "soft";
+ 
+       return SetCGInfo(
+--- a/clang/lib/Driver/ToolChains/Clang.cpp
++++ b/clang/lib/Driver/ToolChains/Clang.cpp
+@@ -1920,14 +1920,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+   const llvm::Triple &T = getToolChain().getTriple();
+   if (T.isOSBinFormatELF()) {
+     switch (getToolChain().getArch()) {
+-    case llvm::Triple::ppc64: {
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
+-      break;
+-    }
++    case llvm::Triple::ppc64:
+     case llvm::Triple::ppc64le:
+       ABIName = "elfv2";
+       break;
diff --git a/srcpkgs/llvm13/patches/compiler-rt-aarch64-ucontext.patch b/srcpkgs/llvm13/patches/compiler-rt-aarch64-ucontext.patch
new file mode 100644
index 000000000000..893c059d7b8d
--- /dev/null
+++ b/srcpkgs/llvm13/patches/compiler-rt-aarch64-ucontext.patch
@@ -0,0 +1,11 @@
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp.orig
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+@@ -1799,7 +1799,7 @@
+ 
+ static bool Aarch64GetESR(ucontext_t *ucontext, u64 *esr) {
+   static const u32 kEsrMagic = 0x45535201;
+-  u8 *aux = ucontext->uc_mcontext.__reserved;
++  u8 *aux = reinterpret_cast<u8 *>(ucontext->uc_mcontext.__reserved);
+   while (true) {
+     _aarch64_ctx *ctx = (_aarch64_ctx *)aux;
+     if (ctx->size == 0) break;
diff --git a/srcpkgs/llvm13/patches/compiler-rt-sanitizer-ppc64-musl.patch b/srcpkgs/llvm13/patches/compiler-rt-sanitizer-ppc64-musl.patch
new file mode 100644
index 000000000000..35f16d24f340
--- /dev/null
+++ b/srcpkgs/llvm13/patches/compiler-rt-sanitizer-ppc64-musl.patch
@@ -0,0 +1,35 @@
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+@@ -74,6 +74,10 @@
+ #include <sys/utsname.h>
+ #endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #include <sys/personality.h>
+ #endif
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+@@ -92,7 +92,7 @@
+ # include <utime.h>
+ # include <sys/ptrace.h>
+ #if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-    SANITIZER_RISCV64
++    defined(__powerpc__) || SANITIZER_RISCV64
+ #  include <asm/ptrace.h>
+ #  ifdef __arm__
+ typedef struct user_fpregs elf_fpregset_t;
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
+@@ -31,7 +31,7 @@
+ #include <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // for NT_PRSTATUS
+-#if (defined(__aarch64__) || SANITIZER_RISCV64) && !SANITIZER_ANDROID
++#if (defined(__aarch64__) || defined(__powerpc__) || SANITIZER_RISCV64) && !SANITIZER_ANDROID
+ // GLIBC 2.20+ sys/user does not include asm/ptrace.h
+ # include <asm/ptrace.h>
+ #endif
diff --git a/srcpkgs/llvm13/patches/compiler-rt-xray-ppc64-musl.patch b/srcpkgs/llvm13/patches/compiler-rt-xray-ppc64-musl.patch
new file mode 100644
index 000000000000..d0b61c80c897
--- /dev/null
+++ b/srcpkgs/llvm13/patches/compiler-rt-xray-ppc64-musl.patch
@@ -0,0 +1,62 @@
+--- a/compiler-rt/lib/xray/xray_powerpc64.inc
++++ b/compiler-rt/lib/xray/xray_powerpc64.inc
+@@ -12,7 +12,13 @@
+ 
+ #include <cstdint>
+ #include <mutex>
++#ifdef __GLIBC__
+ #include <sys/platform/ppc.h>
++#else
++#include <cctype>
++#include <cstring>
++#include <cstdlib>
++#endif
+ 
+ #include "xray_defs.h"
+ 
+@@ -20,13 +26,45 @@ namespace __xray {
+ 
+ ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
+   CPU = 0;
++#ifdef __GLIBC__
+   return __ppc_get_timebase();
++#else
++  return __builtin_ppc_get_timebase();
++#endif
+ }
+ 
+ inline uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
+   static std::mutex M;
+   std::lock_guard<std::mutex> Guard(M);
++#ifdef __GLIBC__
+   return __ppc_get_timebase_freq();
++#else
++  /* FIXME: a less dirty implementation? */
++  static uint64_t base;
++  if (!base) {
++    FILE *f = fopen("/proc/cpuinfo", "rb");
++    if (f) {
++      ssize_t nr;
++      /* virtually always big enough to hold the line */
++      char buf[512];
++      while (fgets(buf, sizeof(buf), f)) {
++        char *ret = strstr(buf, "timebase");
++        if (!ret) {
++          continue;
++        }
++        ret += sizeof("timebase") - 1;
++        ret = strchr(ret, ':');
++        if (!ret) {
++          continue;
++        }
++        base = strtoul(ret + 1, nullptr, 10);
++        break;
++      }
++      fclose(f);
++    }
++  }
++  return base;
++#endif
+ }
+ 
+ inline bool probeRequiredCPUFeatures() XRAY_NEVER_INSTRUMENT {
diff --git a/srcpkgs/llvm13/patches/libcxx-musl.patch b/srcpkgs/llvm13/patches/libcxx-musl.patch
new file mode 100644
index 000000000000..bbd31ffc2cb1
--- /dev/null
+++ b/srcpkgs/llvm13/patches/libcxx-musl.patch
@@ -0,0 +1,26 @@
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -742,7 +742,11 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
+         typename remove_reference<decltype(errno)>::type __save_errno = errno;
+         errno = 0;
+         char *__p2;
++#if defined(__linux__) && !defined(__GLIBC__)
++        long long __ll = strtoll(__a, &__p2, __base);
++#else
+         long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
++#endif
+         typename remove_reference<decltype(errno)>::type __current_errno = errno;
+         if (__current_errno == 0)
+             errno = __save_errno;
+@@ -782,7 +786,11 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
+         typename remove_reference<decltype(errno)>::type __save_errno = errno;
+         errno = 0;
+         char *__p2;
++#if defined(__linux__) && !defined(__GLIBC__)
++        unsigned long long __ll = strtoull(__a, &__p2, __base);
++#else
+         unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
++#endif
+         typename remove_reference<decltype(errno)>::type __current_errno = errno;
+         if (__current_errno == 0)
+             errno = __save_errno;
diff --git a/srcpkgs/llvm13/patches/libcxx-ppc.patch b/srcpkgs/llvm13/patches/libcxx-ppc.patch
new file mode 100644
index 000000000000..7a92f8004e1c
--- /dev/null
+++ b/srcpkgs/llvm13/patches/libcxx-ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- a/libcxx/include/limits
++++ b/libcxx/include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/llvm13/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm13/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm13/patches/libcxx-ssp-nonshared.patch
@@ -0,0 +1,11 @@
+--- a/libcxx/CMakeLists.txt
++++ b/libcxx/CMakeLists.txt
+@@ -769,6 +769,8 @@ function(cxx_link_system_libraries target)
+     target_link_libraries(${target} PRIVATE atomic)
+   endif()
+ 
++#ssp  target_link_libraries(${target} PRIVATE ssp_nonshared)
++
+   if (MINGW)
+     target_link_libraries(${target} PRIVATE "${MINGW_LIBRARIES}")
+   endif()
diff --git a/srcpkgs/llvm13/patches/libcxxabi-dl.patch b/srcpkgs/llvm13/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm13/patches/libcxxabi-dl.patch
@@ -0,0 +1,25 @@
+Also link to -ldl to prevent undefined references.
+
+--- a/libcxxabi/src/CMakeLists.txt
++++ b/libcxxabi/src/CMakeLists.txt
+@@ -73,6 +73,7 @@
+   endif()
+ 
+   add_library_flags_if(LIBCXXABI_HAS_C_LIB c)
++  add_library_flags_if(LIBCXXABI_HAS_C_LIB dl)
+ endif()
+ 
+ if (LIBCXXABI_USE_LLVM_UNWINDER)
+--- a/libcxx/CMakeLists.txt
++++ b/libcxx/CMakeLists.txt
+@@ -745,6 +745,10 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm13/patches/libunwind-ppc32.patch b/srcpkgs/llvm13/patches/libunwind-ppc32.patch
new file mode 100644
index 000000000000..74aa7576ecf9
--- /dev/null
+++ b/srcpkgs/llvm13/patches/libunwind-ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- a/libunwind/include/__libunwind_config.h
++++ b/libunwind/include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- a/libunwind/src/UnwindRegistersRestore.S
++++ b/libunwind/src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- a/libunwind/src/UnwindRegistersSave.S
++++ b/libunwind/src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- a/libunwind/src/config.h
++++ b/libunwind/src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- a/libunwind/src/libunwind.cpp
++++ b/libunwind/src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm13/patches/lldb-musl.patch b/srcpkgs/llvm13/patches/lldb-musl.patch
new file mode 100644
index 000000000000..601c0d138523
--- /dev/null
+++ b/srcpkgs/llvm13/patches/lldb-musl.patch
@@ -0,0 +1,31 @@
+--- a/lldb/source/Plugins/Process/Linux/Procfs.h
++++ b/lldb/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm13/patches/llvm-001-musl.patch b/srcpkgs/llvm13/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..f2a3f8d62813
--- /dev/null
+++ b/srcpkgs/llvm13/patches/llvm-001-musl.patch
@@ -0,0 +1,57 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index 34a8a1e3..1214ece5 100644
+--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ class Triple;
+diff --git a/lib/Support/Unix/DynamicLibrary.inc b/lib/Support/Unix/DynamicLibrary.inc
+index a2a37996..2f86c470 100644
+--- a/llvm/lib/Support/Unix/DynamicLibrary.inc
++++ b/llvm/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/llvm/utils/unittest/googletest/src/gtest.cc
++++ b/llvm/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm13/patches/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm13/patches/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 000000000000..0071d964bd37
--- /dev/null
+++ b/srcpkgs/llvm13/patches/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,30 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp
+index 0634833e..b7cbc2e7 100644
+--- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -222,9 +222,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+diff --git a/test/CodeGen/PowerPC/ppc64-elf-abi.ll b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+index 8b1cf6b5..296a2afa 100644
+--- a/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm13/patches/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm13/patches/llvm-003-ppc-secureplt.patch
new file mode 100644
index 000000000000..b5d15974375d
--- /dev/null
+++ b/srcpkgs/llvm13/patches/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -165,7 +165,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm13/patches/llvm-004-override-opt.patch b/srcpkgs/llvm13/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm13/patches/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/llvm/CMakeLists.txt
++++ b/llvm/CMakeLists.txt
+@@ -918,6 +918,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
+   llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
+ endif()
+ 
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm13/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm13/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm13/patches/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,36 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index cce21f32..87ca5f9b 100644
+--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -520,7 +520,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/lib/Target/PowerPC/PPCMCInstLower.cpp b/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 5cc180d7..a5b02565 100644
+--- a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -117,7 +117,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
diff --git a/srcpkgs/llvm13/patches/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm13/patches/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 000000000000..a00abd216665
--- /dev/null
+++ b/srcpkgs/llvm13/patches/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -58,7 +58,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm13/patches/ppc32-compiler-rt.patch b/srcpkgs/llvm13/patches/ppc32-compiler-rt.patch
new file mode 100644
index 000000000000..8e0a9a779d1b
--- /dev/null
+++ b/srcpkgs/llvm13/patches/ppc32-compiler-rt.patch
@@ -0,0 +1,21 @@
+commit ba4ede595ff9599232f5dd2b4384c243137b53fc
+Author: Daniel Kolesa <daniel@octaforge.org>
+Date:   Tue Jun 22 23:40:54 2021 +0200
+
+    enable compiler-rt support for ppc32
+
+diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
+index 1edab43..5c0c8a2 100644
+--- a/compiler-rt/cmake/base-config-ix.cmake
++++ b/compiler-rt/cmake/base-config-ix.cmake
+@@ -182,9 +182,7 @@ macro(test_targets)
+     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc64le")
+       test_target_arch(powerpc64le "" "-m64")
+     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc")
+-      if(CMAKE_SYSTEM_NAME MATCHES "AIX")
+-        test_target_arch(powerpc "" "-m32")
+-      endif()
++      test_target_arch(powerpc "" "-m32")
+       test_target_arch(powerpc64 "" "-m64")
+     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "s390x")
+       test_target_arch(s390x "" "")
diff --git a/srcpkgs/llvm13/template b/srcpkgs/llvm13/template
new file mode 100644
index 000000000000..08d847472525
--- /dev/null
+++ b/srcpkgs/llvm13/template
@@ -0,0 +1,423 @@
+# Template file for 'llvm13'
+pkgname=llvm13
+version=13.0.0
+revision=1
+wrksrc="llvm-project-${version}.src"
+build_wrksrc=llvm
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release -Wno-dev
+ -DENABLE_LINKER_BUILD_ID=YES
+ -DLLDB_USE_SYSTEM_SIX=YES
+ -DLIBCXX_CXX_ABI=libcxxabi
+ -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLLVM_INCLUDE_DOCS=YES
+ -DLLVM_BUILD_DOCS=YES
+ -DLLVM_ENABLE_SPHINX=YES
+ -DSPHINX_WARNINGS_AS_ERRORS=NO
+ -DLLVM_INSTALL_UTILS=YES
+ -DLLVM_BUILD_LLVM_DYLIB=YES
+ -DLLVM_LINK_LLVM_DYLIB=YES
+ -DLLVM_ENABLE_RTTI=YES
+ -DLLVM_ENABLE_FFI=YES
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
+ python3-recommonmark python3-sphinx-automodapi"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm13>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
+checksum=6075ad30f1ac0e15f07c1bf062c1e1268c241d674f11bd32cdf0e040c71f2bf3
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
+	makedepends+=" libexecinfo-devel"
+	depends+=" libexecinfo-devel"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;libunwind;lld"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm13"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; then
+		if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+			vsed -i 's|__ptrace_request|int|g' \
+				${wrksrc}/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+		fi
+		# disable docs for lldb as they fail to generate
+		vsed -i '/add_subdirectory(docs)/d' \
+			${wrksrc}/lldb/CMakeLists.txt
+	fi
+
+	# update config.guess for better platform detection
+	cp $XBPS_COMMONDIR/environment/configure/automake/config.guess \
+		${wrksrc}/llvm/cmake
+
+	# fix linker failures on some archs
+	vsed -i 's,check_library_exists(gcc_s .*,set(LIBCXXABI_HAS_GCC_S_LIB ON),' \
+		${wrksrc}/libcxxabi/cmake/config-ix.cmake
+	vsed -i 's,check_library_exists(gcc .*,set(LIBCXXABI_HAS_GCC_LIB ON),' \
+		${wrksrc}/libcxxabi/cmake/config-ix.cmake
+
+	# need libssp_nonshared on some musl platforms (because of nodefaultlibs)
+	case "$XBPS_TARGET_MACHINE" in
+		ppc64*) ;;
+		ppc*-musl|i686-musl|mips*-musl)
+			vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \
+				${wrksrc}/libunwind/src/CMakeLists.txt
+			vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \
+				${wrksrc}/libcxxabi/src/CMakeLists.txt
+			vsed -i 's,#ssp,,' ${wrksrc}/libcxx/CMakeLists.txt
+			;;
+	esac
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64-musl) # some sanitizer currently only on x86_64 stuff needs backtrace
+			vsed -i 's,# Set common link flags.,list(APPEND SANITIZER_COMMON_LINK_LIBS execinfo),' \
+				${wrksrc}/compiler-rt/CMakeLists.txt
+			;;
+		arm*-musl|i686-musl) # sanitizer code is broken since it duplicates some libc bits
+			vsed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' \
+				${wrksrc}/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+}
+
+pre_configure() {
+	local triplet
+
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		ppc64*) ;;
+		mips*-musl|ppc*) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+		riscv64*) _arch="RISCV64";;
+	esac
+
+	triplet=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}
+
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${triplet}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${triplet}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+
+	# Install libcxxabi headers
+	vinstall ${wrksrc}/libcxxabi/include/__cxxabi_config.h 644 usr/include
+	vinstall ${wrksrc}/libcxxabi/include/cxxabi.h 644 usr/include
+
+	# Install libunwind headers
+	vinstall ${wrksrc}/libunwind/include/__libunwind_config.h 644 usr/include
+	vinstall ${wrksrc}/libunwind/include/libunwind.h 644 usr/include
+	vinstall ${wrksrc}/libunwind/include/unwind.h 644 usr/include
+	vinstall ${wrksrc}/libunwind/include/mach-o/compact_unwind_encoding.h \
+		644 usr/include/mach-o
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/include/clang-tidy
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/clang
+		vmove usr/share/man/man1/clang.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+		vmove usr/bin/ld64.lld*
+		vmove usr/share/doc/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+llvm-libunwind_package() {
+	short_desc+=" - libunwind"
+	pkg_install() {
+		vmove "usr/lib/libunwind.so.*"
+	}
+}
+
+llvm-libunwind-devel_package() {
+	short_desc+=" - libunwind - development files"
+	depends="llvm-libunwind>=${version}_${revision}"
+	conflicts="libunwind-devel>=0"
+	pkg_install() {
+		vmove usr/lib/libunwind.so
+		vmove usr/lib/libunwind.a
+		vmove "usr/include/*unwind*"
+		vmove usr/include/mach-o
+		vmove usr/share/doc/libunwind
+	}
+}
+
+libcxxabi_package() {
+	short_desc+=" - low level support for libc++"
+	pkg_install() {
+		vmove "usr/lib/libc++abi.so.*"
+	}
+}
+
+libcxxabi-devel_package() {
+	short_desc+=" - low level support for libc++ - development files"
+	depends="libcxxabi>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/libc++abi.so
+		vmove usr/lib/libc++abi.a
+		vmove "usr/include/*cxxabi*"
+	}
+}
+
+libcxx_package() {
+	short_desc+=" - C++ standard library"
+	pkg_install() {
+		vmove "usr/lib/libc++.so.*"
+	}
+}
+
+libcxx-devel_package() {
+	short_desc+=" - C++ standard library - development files"
+	depends="libcxx>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/libc++.so
+		vmove usr/lib/libc++.a
+		vmove usr/lib/libc++experimental.a
+		vmove usr/include/c++
+		vmove usr/share/doc/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libomp.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove usr/lib/libarcher.so
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/include/omp*.h"
+		vmove "usr/lib/clang/${version}/include/omp*.h"
+		vmove usr/share/man/man1/llvmopenmp.1
+		vmove usr/share/doc/openmp
+	}
+}
+
+libllvm13_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm13/update b/srcpkgs/llvm13/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm13/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

From d9b8de2d22dc385400dbb2b722f474734083009e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Fri, 31 Dec 2021 16:23:17 +0200
Subject: [PATCH 02/30] llvm: update to 13.0.0

---
 srcpkgs/llvm/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index a92db6f94f9f..bcfee82098ff 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=12.0.0
+version=13.0.0
 revision=1
 build_style=meta
-depends="llvm12"
-replaces="llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm13"
+replaces="llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From bd4facc3f755b71a7de1c36b56ccceffb876a9e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Fri, 31 Dec 2021 16:43:56 +0200
Subject: [PATCH 03/30] llvm12: remove clang parts

---
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ---
 .../patches/clang-002-add-musl-triples.patch  | 110 -------
 .../clang-003-ppc64-dynamic-linker-path.patch |  13 -
 .../patches/clang-004-ppc64-musl-elfv2.patch  |  48 ---
 .../compiler-rt-aarch64-ucontext.patch        |  11 -
 .../compiler-rt-sanitizer-ppc64-musl.patch    |  35 --
 .../llvm12/patches/compiler-rt-size_t.patch   |  10 -
 .../patches/compiler-rt-xray-ppc64-musl.patch |  62 ----
 srcpkgs/llvm12/patches/libcxx-musl.patch      |  26 --
 srcpkgs/llvm12/patches/libcxx-ppc.patch       |  22 --
 .../llvm12/patches/libcxx-ssp-nonshared.patch |  11 -
 srcpkgs/llvm12/patches/libcxxabi-dl.patch     |  25 --
 srcpkgs/llvm12/patches/libunwind-ppc32.patch  |  63 ----
 srcpkgs/llvm12/patches/lldb-musl.patch        |  31 --
 .../llvm12/patches/ppc32-compiler-rt.patch    |  21 --
 srcpkgs/llvm12/template                       | 301 +-----------------
 16 files changed, 1 insertion(+), 832 deletions(-)
 delete mode 100644 srcpkgs/llvm12/patches/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm12/patches/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm12/patches/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm12/patches/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm12/patches/compiler-rt-aarch64-ucontext.patch
 delete mode 100644 srcpkgs/llvm12/patches/compiler-rt-sanitizer-ppc64-musl.patch
 delete mode 100644 srcpkgs/llvm12/patches/compiler-rt-size_t.patch
 delete mode 100644 srcpkgs/llvm12/patches/compiler-rt-xray-ppc64-musl.patch
 delete mode 100644 srcpkgs/llvm12/patches/libcxx-musl.patch
 delete mode 100644 srcpkgs/llvm12/patches/libcxx-ppc.patch
 delete mode 100644 srcpkgs/llvm12/patches/libcxx-ssp-nonshared.patch
 delete mode 100644 srcpkgs/llvm12/patches/libcxxabi-dl.patch
 delete mode 100644 srcpkgs/llvm12/patches/libunwind-ppc32.patch
 delete mode 100644 srcpkgs/llvm12/patches/lldb-musl.patch
 delete mode 100644 srcpkgs/llvm12/patches/ppc32-compiler-rt.patch

diff --git a/srcpkgs/llvm12/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm12/patches/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index e4eaa7783e7a..000000000000
--- a/srcpkgs/llvm12/patches/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/clang/lib/Headers/unwind.h
-+++ b/clang/lib/Headers/unwind.h
-@@ -9,9 +9,6 @@
- 
- /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
- 
--#ifndef __CLANG_UNWIND_H
--#define __CLANG_UNWIND_H
--
- #if defined(__APPLE__) && __has_include_next(<unwind.h>)
- /* Darwin (from 11.x on) provide an unwind.h. If that's available,
-  * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm12/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm12/patches/clang-002-add-musl-triples.patch
deleted file mode 100644
index 25688d40dbc2..000000000000
--- a/srcpkgs/llvm12/patches/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,110 +0,0 @@
---- a/clang/lib/Driver/ToolChains/Gnu.cpp
-+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
-@@ -2086,7 +2086,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2153,8 +2154,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-       "powerpc64-suse-linux", "powerpc-montavista-linuxspe"};
-   static const char *const PPCLELibDirs[] = {"/lib32", "/lib"};
-   static const char *const PPCLETriples[] = {"powerpcle-linux-gnu",
--                                             "powerpcle-unknown-linux-gnu",
--                                             "powerpcle-linux-musl"};
-+                                             "powerpcle-unknown-linux-gnu"};
- 
-   static const char *const PPC64LibDirs[] = {"/lib64", "/lib"};
-   static const char *const PPC64Triples[] = {
-@@ -2235,6 +2235,87 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPCLEMuslTriples[] = {"powerpcle-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppcle:
-+      LibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
-+      TripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      BiarchTripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      BiarchLibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
-+      BiarchTripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm12/patches/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm12/patches/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4ad6412d1e6c..000000000000
--- a/srcpkgs/llvm12/patches/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/clang/lib/Driver/ToolChains/Linux.cpp
-+++ b/clang/lib/Driver/ToolChains/Linux.cpp
-@@ -504,10 +504,6 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
--    Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
--    break;
-   case llvm::Triple::ppc64le:
-     LibDir = "lib64";
-     Loader =
diff --git a/srcpkgs/llvm12/patches/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm12/patches/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index 21fc8003c5f1..000000000000
--- a/srcpkgs/llvm12/patches/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,48 +0,0 @@
---- a/clang/lib/Basic/Targets/PPC.h
-+++ b/clang/lib/Basic/Targets/PPC.h
-@@ -415,11 +415,10 @@ public:
-       LongDoubleFormat = &llvm::APFloat::IEEEdouble();
-     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       DataLayout = "e-m:e-i64:64-n32:64";
--      ABI = "elfv2";
-     } else {
-       DataLayout = "E-m:e-i64:64-n32:64";
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) {
-       LongDoubleWidth = LongDoubleAlign = 64;
---- a/clang/lib/CodeGen/TargetInfo.cpp
-+++ b/clang/lib/CodeGen/TargetInfo.cpp
-@@ -10927,9 +10927,9 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
-       return SetCGInfo(new AIXTargetCodeGenInfo(Types, /*Is64Bit*/ true));
- 
-     if (Triple.isOSBinFormatELF()) {
--      PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv1;
--      if (getTarget().getABI() == "elfv2")
--        Kind = PPC64_SVR4_ABIInfo::ELFv2;
-+      PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv2;
-+      if (getTarget().getABI() == "elfv1")
-+        Kind = PPC64_SVR4_ABIInfo::ELFv1;
-       bool IsSoftFloat = CodeGenOpts.FloatABI == "soft";
- 
-       return SetCGInfo(
---- a/clang/lib/Driver/ToolChains/Clang.cpp
-+++ b/clang/lib/Driver/ToolChains/Clang.cpp
-@@ -1920,14 +1920,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-   const llvm::Triple &T = getToolChain().getTriple();
-   if (T.isOSBinFormatELF()) {
-     switch (getToolChain().getArch()) {
--    case llvm::Triple::ppc64: {
--      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
--          T.isOSOpenBSD() || T.isMusl())
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
--      break;
--    }
-+    case llvm::Triple::ppc64:
-     case llvm::Triple::ppc64le:
-       ABIName = "elfv2";
-       break;
diff --git a/srcpkgs/llvm12/patches/compiler-rt-aarch64-ucontext.patch b/srcpkgs/llvm12/patches/compiler-rt-aarch64-ucontext.patch
deleted file mode 100644
index 893c059d7b8d..000000000000
--- a/srcpkgs/llvm12/patches/compiler-rt-aarch64-ucontext.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp.orig
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
-@@ -1799,7 +1799,7 @@
- 
- static bool Aarch64GetESR(ucontext_t *ucontext, u64 *esr) {
-   static const u32 kEsrMagic = 0x45535201;
--  u8 *aux = ucontext->uc_mcontext.__reserved;
-+  u8 *aux = reinterpret_cast<u8 *>(ucontext->uc_mcontext.__reserved);
-   while (true) {
-     _aarch64_ctx *ctx = (_aarch64_ctx *)aux;
-     if (ctx->size == 0) break;
diff --git a/srcpkgs/llvm12/patches/compiler-rt-sanitizer-ppc64-musl.patch b/srcpkgs/llvm12/patches/compiler-rt-sanitizer-ppc64-musl.patch
deleted file mode 100644
index 35f16d24f340..000000000000
--- a/srcpkgs/llvm12/patches/compiler-rt-sanitizer-ppc64-musl.patch
+++ /dev/null
@@ -1,35 +0,0 @@
---- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
-@@ -74,6 +74,10 @@
- #include <sys/utsname.h>
- #endif
- 
-+#if SANITIZER_LINUX && defined(__powerpc__)
-+#include <asm/ptrace.h>
-+#endif
-+
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
- #include <sys/personality.h>
- #endif
---- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
-@@ -92,7 +92,7 @@
- # include <utime.h>
- # include <sys/ptrace.h>
- #if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
--    SANITIZER_RISCV64
-+    defined(__powerpc__) || SANITIZER_RISCV64
- #  include <asm/ptrace.h>
- #  ifdef __arm__
- typedef struct user_fpregs elf_fpregset_t;
---- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
-@@ -31,7 +31,7 @@
- #include <sys/types.h> // for pid_t
- #include <sys/uio.h> // for iovec
- #include <elf.h> // for NT_PRSTATUS
--#if (defined(__aarch64__) || SANITIZER_RISCV64) && !SANITIZER_ANDROID
-+#if (defined(__aarch64__) || defined(__powerpc__) || SANITIZER_RISCV64) && !SANITIZER_ANDROID
- // GLIBC 2.20+ sys/user does not include asm/ptrace.h
- # include <asm/ptrace.h>
- #endif
diff --git a/srcpkgs/llvm12/patches/compiler-rt-size_t.patch b/srcpkgs/llvm12/patches/compiler-rt-size_t.patch
deleted file mode 100644
index 2c63063a5e9e..000000000000
--- a/srcpkgs/llvm12/patches/compiler-rt-size_t.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp.orig
-+++ b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
-@@ -25,6 +25,7 @@
-   }
- 
- #include <cassert>
-+#include <cstddef>
- #include <cstdint>
- #include <dlfcn.h> // for dlsym()
- 
diff --git a/srcpkgs/llvm12/patches/compiler-rt-xray-ppc64-musl.patch b/srcpkgs/llvm12/patches/compiler-rt-xray-ppc64-musl.patch
deleted file mode 100644
index d0b61c80c897..000000000000
--- a/srcpkgs/llvm12/patches/compiler-rt-xray-ppc64-musl.patch
+++ /dev/null
@@ -1,62 +0,0 @@
---- a/compiler-rt/lib/xray/xray_powerpc64.inc
-+++ b/compiler-rt/lib/xray/xray_powerpc64.inc
-@@ -12,7 +12,13 @@
- 
- #include <cstdint>
- #include <mutex>
-+#ifdef __GLIBC__
- #include <sys/platform/ppc.h>
-+#else
-+#include <cctype>
-+#include <cstring>
-+#include <cstdlib>
-+#endif
- 
- #include "xray_defs.h"
- 
-@@ -20,13 +26,45 @@ namespace __xray {
- 
- ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
-   CPU = 0;
-+#ifdef __GLIBC__
-   return __ppc_get_timebase();
-+#else
-+  return __builtin_ppc_get_timebase();
-+#endif
- }
- 
- inline uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
-   static std::mutex M;
-   std::lock_guard<std::mutex> Guard(M);
-+#ifdef __GLIBC__
-   return __ppc_get_timebase_freq();
-+#else
-+  /* FIXME: a less dirty implementation? */
-+  static uint64_t base;
-+  if (!base) {
-+    FILE *f = fopen("/proc/cpuinfo", "rb");
-+    if (f) {
-+      ssize_t nr;
-+      /* virtually always big enough to hold the line */
-+      char buf[512];
-+      while (fgets(buf, sizeof(buf), f)) {
-+        char *ret = strstr(buf, "timebase");
-+        if (!ret) {
-+          continue;
-+        }
-+        ret += sizeof("timebase") - 1;
-+        ret = strchr(ret, ':');
-+        if (!ret) {
-+          continue;
-+        }
-+        base = strtoul(ret + 1, nullptr, 10);
-+        break;
-+      }
-+      fclose(f);
-+    }
-+  }
-+  return base;
-+#endif
- }
- 
- inline bool probeRequiredCPUFeatures() XRAY_NEVER_INSTRUMENT {
diff --git a/srcpkgs/llvm12/patches/libcxx-musl.patch b/srcpkgs/llvm12/patches/libcxx-musl.patch
deleted file mode 100644
index bbd31ffc2cb1..000000000000
--- a/srcpkgs/llvm12/patches/libcxx-musl.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/libcxx/include/locale
-+++ b/libcxx/include/locale
-@@ -742,7 +742,11 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
-         typename remove_reference<decltype(errno)>::type __save_errno = errno;
-         errno = 0;
-         char *__p2;
-+#if defined(__linux__) && !defined(__GLIBC__)
-+        long long __ll = strtoll(__a, &__p2, __base);
-+#else
-         long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
-+#endif
-         typename remove_reference<decltype(errno)>::type __current_errno = errno;
-         if (__current_errno == 0)
-             errno = __save_errno;
-@@ -782,7 +786,11 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
-         typename remove_reference<decltype(errno)>::type __save_errno = errno;
-         errno = 0;
-         char *__p2;
-+#if defined(__linux__) && !defined(__GLIBC__)
-+        unsigned long long __ll = strtoull(__a, &__p2, __base);
-+#else
-         unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
-+#endif
-         typename remove_reference<decltype(errno)>::type __current_errno = errno;
-         if (__current_errno == 0)
-             errno = __save_errno;
diff --git a/srcpkgs/llvm12/patches/libcxx-ppc.patch b/srcpkgs/llvm12/patches/libcxx-ppc.patch
deleted file mode 100644
index 7a92f8004e1c..000000000000
--- a/srcpkgs/llvm12/patches/libcxx-ppc.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-This ensures `is_iec559` is defined correctly under all long double ABIs,
-including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
-is not defined on gcc.
-
---- a/libcxx/include/limits
-+++ b/libcxx/include/limits
-@@ -426,8 +426,14 @@ protected:
-     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
-     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
- 
--#if (defined(__ppc__) || defined(__ppc64__))
-+#if defined(__powerpc__) || defined(__powerpc64__)
-+#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
-+    /* IEEE 754 quadruple or double precision */
-+    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
-+#else
-+    /* 128-bit IBM double-double */
-     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
-+#endif
- #else
-     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
- #endif
diff --git a/srcpkgs/llvm12/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm12/patches/libcxx-ssp-nonshared.patch
deleted file mode 100644
index 70292beb2fcd..000000000000
--- a/srcpkgs/llvm12/patches/libcxx-ssp-nonshared.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libcxx/CMakeLists.txt
-+++ b/libcxx/CMakeLists.txt
-@@ -769,6 +769,8 @@ function(cxx_link_system_libraries target)
-     target_link_libraries(${target} PRIVATE atomic)
-   endif()
- 
-+#ssp  target_link_libraries(${target} PRIVATE ssp_nonshared)
-+
-   if (MINGW)
-     target_link_libraries(${target} PRIVATE "${MINGW_LIBRARIES}")
-   endif()
diff --git a/srcpkgs/llvm12/patches/libcxxabi-dl.patch b/srcpkgs/llvm12/patches/libcxxabi-dl.patch
deleted file mode 100644
index 3a15f9db8c98..000000000000
--- a/srcpkgs/llvm12/patches/libcxxabi-dl.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Also link to -ldl to prevent undefined references.
-
---- a/libcxxabi/src/CMakeLists.txt
-+++ b/libcxxabi/src/CMakeLists.txt
-@@ -73,6 +73,7 @@
-   endif()
- 
-   add_library_flags_if(LIBCXXABI_HAS_C_LIB c)
-+  add_library_flags_if(LIBCXXABI_HAS_C_LIB dl)
- endif()
- 
- if (LIBCXXABI_USE_LLVM_UNWINDER)
---- a/libcxx/CMakeLists.txt
-+++ b/libcxx/CMakeLists.txt
-@@ -745,6 +745,10 @@
-     target_link_libraries(${target} PRIVATE m)
-   endif()
- 
-+  if (LIBCXX_HAS_C_LIB)
-+    target_link_libraries(${target} PRIVATE dl)
-+  endif()
-+
-   if (LIBCXX_HAS_RT_LIB)
-     target_link_libraries(${target} PRIVATE rt)
-   endif()
diff --git a/srcpkgs/llvm12/patches/libunwind-ppc32.patch b/srcpkgs/llvm12/patches/libunwind-ppc32.patch
deleted file mode 100644
index 74aa7576ecf9..000000000000
--- a/srcpkgs/llvm12/patches/libunwind-ppc32.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-This fixes build at least with gcc9 which does not define `__ppc__`.
-
---- a/libunwind/include/__libunwind_config.h
-+++ b/libunwind/include/__libunwind_config.h
-@@ -49,7 +49,7 @@
- #  define _LIBUNWIND_CONTEXT_SIZE 167
- #  define _LIBUNWIND_CURSOR_SIZE 179
- #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
--# elif defined(__ppc__)
-+# elif defined(__powerpc__)
- #  define _LIBUNWIND_TARGET_PPC 1
- #  define _LIBUNWIND_CONTEXT_SIZE 117
- #  define _LIBUNWIND_CURSOR_SIZE 124
---- a/libunwind/src/UnwindRegistersRestore.S
-+++ b/libunwind/src/UnwindRegistersRestore.S
-@@ -392,7 +392,7 @@ Lnovec:
-   PPC64_LR(3)
-   bctr
- 
--#elif defined(__ppc__)
-+#elif defined(__powerpc__)
- 
- DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
- //
---- a/libunwind/src/UnwindRegistersSave.S
-+++ b/libunwind/src/UnwindRegistersSave.S
-@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
-   blr
- 
- 
--#elif defined(__ppc__)
-+#elif defined(__powerpc__)
- 
- //
- // extern int unw_getcontext(unw_context_t* thread_state)
---- a/libunwind/src/config.h
-+++ b/libunwind/src/config.h
-@@ -95,12 +95,12 @@
- #define _LIBUNWIND_BUILD_SJLJ_APIS
- #endif
- 
--#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
- #define _LIBUNWIND_SUPPORT_FRAME_APIS
- #endif
- 
- #if defined(__i386__) || defined(__x86_64__) ||                                \
--    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
-+    defined(__powerpc__) || defined(__powerpc64__) ||                          \
-     (!defined(__APPLE__) && defined(__arm__)) ||                               \
-     (defined(__arm64__) || defined(__aarch64__)) ||                            \
-     defined(__mips__)
---- a/libunwind/src/libunwind.cpp
-+++ b/libunwind/src/libunwind.cpp
-@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
- # define REGISTER_KIND Registers_x86_64
- #elif defined(__powerpc64__)
- # define REGISTER_KIND Registers_ppc64
--#elif defined(__ppc__)
-+#elif defined(__powerpc__)
- # define REGISTER_KIND Registers_ppc
- #elif defined(__aarch64__)
- # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm12/patches/lldb-musl.patch b/srcpkgs/llvm12/patches/lldb-musl.patch
deleted file mode 100644
index 601c0d138523..000000000000
--- a/srcpkgs/llvm12/patches/lldb-musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/lldb/source/Plugins/Process/Linux/Procfs.h
-+++ b/lldb/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm12/patches/ppc32-compiler-rt.patch b/srcpkgs/llvm12/patches/ppc32-compiler-rt.patch
deleted file mode 100644
index 8e0a9a779d1b..000000000000
--- a/srcpkgs/llvm12/patches/ppc32-compiler-rt.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-commit ba4ede595ff9599232f5dd2b4384c243137b53fc
-Author: Daniel Kolesa <daniel@octaforge.org>
-Date:   Tue Jun 22 23:40:54 2021 +0200
-
-    enable compiler-rt support for ppc32
-
-diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
-index 1edab43..5c0c8a2 100644
---- a/compiler-rt/cmake/base-config-ix.cmake
-+++ b/compiler-rt/cmake/base-config-ix.cmake
-@@ -182,9 +182,7 @@ macro(test_targets)
-     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc64le")
-       test_target_arch(powerpc64le "" "-m64")
-     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc")
--      if(CMAKE_SYSTEM_NAME MATCHES "AIX")
--        test_target_arch(powerpc "" "-m32")
--      endif()
-+      test_target_arch(powerpc "" "-m32")
-       test_target_arch(powerpc64 "" "-m64")
-     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "s390x")
-       test_target_arch(s390x "" "")
diff --git a/srcpkgs/llvm12/template b/srcpkgs/llvm12/template
index 7ce18028e4a3..7b361bbbf5bc 100644
--- a/srcpkgs/llvm12/template
+++ b/srcpkgs/llvm12/template
@@ -1,25 +1,17 @@
 # Template file for 'llvm12'
 pkgname=llvm12
 version=12.0.1
-revision=2
+revision=3
 wrksrc="llvm-project-${version}.src"
 build_wrksrc=llvm
 build_style=cmake
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
- -DLLDB_USE_SYSTEM_SIX=YES
- -DLIBCXX_CXX_ABI=libcxxabi
- -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES
- -DLIBCXXABI_USE_LLVM_UNWINDER=YES
- -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
- -DLIBOMP_ENABLE_SHARED=YES
- -DLIBOMP_INSTALL_ALIASES=NO
  -DLLVM_INCLUDE_DOCS=YES
  -DLLVM_BUILD_DOCS=YES
  -DLLVM_ENABLE_SPHINX=YES
  -DSPHINX_WARNINGS_AS_ERRORS=NO
- -DLLVM_INSTALL_UTILS=YES
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DLLVM_ENABLE_RTTI=YES
@@ -51,87 +43,10 @@ case "$XBPS_TARGET_MACHINE" in
 	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
 esac
 
-_enabled_projects="clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;libunwind;lld"
-
-_lldb_enable=yes
-_libomp_enable=no
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*|i686*) _lldb_enable=no ;;
-esac
-
-case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
-esac
-
-subpackages="clang-tools-extra"
-
-# must go before clang
-if [ "$_libomp_enable" = "yes" ]; then
-	_enabled_projects+=";openmp"
-	subpackages+=" libomp libomp-devel"
-	# because of cmake nonsense referencing libomptarget.so.*
-	depends+=" libomp>=${version}_${revision}"
-fi
-
-subpackages+=" clang clang-analyzer libclang libclang-cpp
- llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
- libcxxabi libcxxabi-devel libllvm12"
-
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	_enabled_projects+=";lldb"
-	subpackages+=" lldb lldb-devel"
-fi
-
-subpackages+=" lld lld-devel"
-
-configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
-
 post_patch() {
-	if [ "$_lldb_enable" = "yes" ]; then
-		if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-			vsed -i 's|__ptrace_request|int|g' \
-				${wrksrc}/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
-		fi
-		# disable docs for lldb as they fail to generate
-		vsed -i '/add_subdirectory(docs)/d' \
-			${wrksrc}/lldb/CMakeLists.txt
-	fi
-
 	# update config.guess for better platform detection
 	cp $XBPS_COMMONDIR/environment/configure/automake/config.guess \
 		${wrksrc}/llvm/cmake
-
-	# fix linker failures on some archs
-	vsed -i 's,check_library_exists(gcc_s .*,set(LIBCXXABI_HAS_GCC_S_LIB ON),' \
-		${wrksrc}/libcxxabi/cmake/config-ix.cmake
-	vsed -i 's,check_library_exists(gcc .*,set(LIBCXXABI_HAS_GCC_LIB ON),' \
-		${wrksrc}/libcxxabi/cmake/config-ix.cmake
-
-	# need libssp_nonshared on some musl platforms (because of nodefaultlibs)
-	case "$XBPS_TARGET_MACHINE" in
-		ppc64*) ;;
-		ppc*-musl|i686-musl|mips*-musl)
-			vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \
-				${wrksrc}/libunwind/src/CMakeLists.txt
-			vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \
-				${wrksrc}/libcxxabi/src/CMakeLists.txt
-			vsed -i 's,#ssp,,' ${wrksrc}/libcxx/CMakeLists.txt
-			;;
-	esac
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64-musl) # some sanitizer currently only on x86_64 stuff needs backtrace
-			vsed -i 's,# Set common link flags.,list(APPEND SANITIZER_COMMON_LINK_LIBS execinfo),' \
-				${wrksrc}/compiler-rt/CMakeLists.txt
-			;;
-		arm*-musl|i686-musl) # sanitizer code is broken since it duplicates some libc bits
-			vsed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' \
-				${wrksrc}/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
 }
 
 pre_configure() {
@@ -158,10 +73,8 @@ pre_configure() {
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
 			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
 		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
 		cd ../..
 	fi
@@ -202,218 +115,6 @@ do_install() {
 	if [ "$CROSS_BUILD" ]; then
 		rm -f ${DESTDIR}/usr/bin/llvm-config-host
 	fi
-
-	# Install libcxxabi headers
-	vinstall ${wrksrc}/libcxxabi/include/__cxxabi_config.h 644 usr/include
-	vinstall ${wrksrc}/libcxxabi/include/cxxabi.h 644 usr/include
-
-	# Install libunwind headers
-	vinstall ${wrksrc}/libunwind/include/__libunwind_config.h 644 usr/include
-	vinstall ${wrksrc}/libunwind/include/libunwind.h 644 usr/include
-	vinstall ${wrksrc}/libunwind/include/unwind.h 644 usr/include
-	vinstall ${wrksrc}/libunwind/include/mach-o/compact_unwind_encoding.h \
-		644 usr/include/mach-o
-}
-
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3 perl"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/include/clang-tidy
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-		vmove usr/share/doc/clang-tools
-		vmove usr/share/man/man1/extraclangtools.1
-		vmove usr/share/man/man1/diagtool.1
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove usr/share/clang
-		vmove usr/share/doc/clang
-		vmove usr/share/man/man1/clang.1
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-		vmove usr/bin/ld64.lld*
-		vmove usr/share/doc/lld
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	depends="lld>=${version}_${revision}"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove usr/lib/cmake/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
-llvm-libunwind_package() {
-	short_desc+=" - libunwind"
-	pkg_install() {
-		vmove "usr/lib/libunwind.so.*"
-	}
-}
-
-llvm-libunwind-devel_package() {
-	short_desc+=" - libunwind - development files"
-	depends="llvm-libunwind>=${version}_${revision}"
-	conflicts="libunwind-devel>=0"
-	pkg_install() {
-		vmove usr/lib/libunwind.so
-		vmove usr/lib/libunwind.a
-		vmove "usr/include/*unwind*"
-		vmove usr/include/mach-o
-		vmove usr/share/doc/libunwind
-	}
-}
-
-libcxxabi_package() {
-	short_desc+=" - low level support for libc++"
-	pkg_install() {
-		vmove "usr/lib/libc++abi.so.*"
-	}
-}
-
-libcxxabi-devel_package() {
-	short_desc+=" - low level support for libc++ - development files"
-	depends="libcxxabi>=${version}_${revision}"
-	pkg_install() {
-		vmove usr/lib/libc++abi.so
-		vmove usr/lib/libc++abi.a
-		vmove "usr/include/*cxxabi*"
-	}
-}
-
-libcxx_package() {
-	short_desc+=" - C++ standard library"
-	pkg_install() {
-		vmove "usr/lib/libc++.so.*"
-	}
-}
-
-libcxx-devel_package() {
-	short_desc+=" - C++ standard library - development files"
-	depends="libcxx>=${version}_${revision}"
-	pkg_install() {
-		vmove usr/lib/libc++.so
-		vmove usr/lib/libc++.a
-		vmove usr/lib/libc++experimental.a
-		vmove usr/include/c++
-		vmove usr/share/doc/libcxx
-	}
-}
-
-libomp_package() {
-	short_desc+=" - Clang OpenMP support library"
-	pkg_install() {
-		vmove usr/lib/libomp.so
-		vmove "usr/lib/libomptarget.rtl.*.so"
-		vmove usr/lib/libarcher.so
-		vmove "usr/lib/libomp*.so.*"
-	}
-}
-
-libomp-devel_package() {
-	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
-	pkg_install() {
-		vmove "usr/lib/libomp*.so"
-		vmove "usr/lib/libarcher*"
-		vmove "usr/include/omp*.h"
-		vmove "usr/lib/clang/${version}/include/omp*.h"
-		vmove usr/share/man/man1/llvmopenmp.1
-		vmove usr/share/doc/openmp
-	}
 }
 
 libllvm12_package() {

From 155dc8c8115fc168c1cdaf3acc60b90e484113fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 15:57:59 +0200
Subject: [PATCH 04/30] rtags: rebuild for llvm13

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index b496a1b0e721..9b161e690d76 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=5
+revision=6
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From 4ded230ae85aafcc26a221517b996770626ce871 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 15:58:27 +0200
Subject: [PATCH 05/30] bpftrace: rebuild for llvm13

---
 srcpkgs/bpftrace/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index 28ab3c626399..eb2480d2230e 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.14.1
-revision=1
+revision=2
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run

From 331dd5416abf6e4dbb39d5adf4372f67b91cf1e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 15:58:38 +0200
Subject: [PATCH 06/30] clazy: rebuild for llvm13

---
 srcpkgs/clazy/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 11f3bab55aef..f81de08ab836 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.11
-revision=1
+revision=2
 build_style=cmake
 build_helper=qemu
 hostmakedepends="llvm"

From f591a0e24a2fcc5366709ae295b9c6a68935c81f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 15:58:49 +0200
Subject: [PATCH 07/30] ccls: rebuild for llvm13

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index fbb7c6847bc1..40aba3b55bfe 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20210330
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="llvm ncurses-devel rapidjson zlib-devel clang-tools-extra"

From 9bf0a45dba5d0d81de8ce6ac5cf1f31e6940d825 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 15:59:35 +0200
Subject: [PATCH 08/30] include-what-you-use: rebuild for llvm13

---
 srcpkgs/include-what-you-use/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index b13bb7ee56af..b4b167401ebe 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,6 +1,6 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
-version=0.16
+version=0.17
 revision=1
 wrksrc="${pkgname}"
 build_style=cmake
@@ -12,7 +12,7 @@ maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="NCSA"
 homepage="https://include-what-you-use.org/"
 distfiles="https://include-what-you-use.org/downloads/${pkgname}-${version}.src.tar.gz"
-checksum=8d6fc9b255343bc1e5ec459e39512df1d51c60e03562985e0076036119ff5a1c
+checksum=eca7c04f8b416b6385ed00e33669a7fa4693cd26cb72b522cde558828eb0c665
 python_version=3
 
 post_install() {

From ae05eed9481c1ddcf51acda67f1609ed3b09e651 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 16:01:21 +0200
Subject: [PATCH 09/30] codelite: rebuild for llvm13

---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index 3a993a2c0cfb..24e2c879dd45 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=15.0.6
-revision=1
+revision=2
 build_style=cmake
 build_helper=cmake-wxWidgets-gtk3
 configure_args="-DWITH_PCH=0 -DWITH_WX_CONFIG=wx-config-gtk3

From 296d7eddc15839a36f8385bf18ed872e3aa9d8a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 16:22:48 +0200
Subject: [PATCH 10/30] kdevelop: rebuild for llvm13

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 010185849d80..abf08c313071 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=21.12.3
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From bd9028755f83ac78889ac5d440ee1497fc5b0226 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 16:23:07 +0200
Subject: [PATCH 11/30] juCi++: rebuild for llvm13

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 1a7604b44a00..5103324dec20 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.2
-revision=2
+revision=3
 _libclangmm_commit="b342f4dd6de4fe509a692a4b4fcfc7e24aae9590"
 _tiny_commit="c9c8bf810ddad8cd17882b9a9ee628a690e779f5"
 wrksrc="jucipp-v${version}"

From b09f660bb174419bd8c25f1f79f1ad73b78114ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 18:30:01 +0200
Subject: [PATCH 12/30] llvm13: fix libomp* packages

---
 srcpkgs/llvm13/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm13/template b/srcpkgs/llvm13/template
index 08d847472525..bfc91056d277 100644
--- a/srcpkgs/llvm13/template
+++ b/srcpkgs/llvm13/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm13'
 pkgname=llvm13
 version=13.0.0
-revision=1
+revision=2
 wrksrc="llvm-project-${version}.src"
 build_wrksrc=llvm
 build_style=cmake
@@ -397,6 +397,7 @@ libomp_package() {
 	short_desc+=" - Clang OpenMP support library"
 	pkg_install() {
 		vmove usr/lib/libomp.so
+		vmove usr/lib/libomptarget.so
 		vmove "usr/lib/libomptarget.rtl.*.so"
 		vmove usr/lib/libarcher.so
 	}
@@ -406,7 +407,6 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision}"
 	pkg_install() {
-		vmove "usr/lib/libomp*.so"
 		vmove "usr/lib/libarcher*"
 		vmove "usr/include/omp*.h"
 		vmove "usr/lib/clang/${version}/include/omp*.h"

From d9a9ff4b85f455d152c5a40396901c106b2b8a73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sun, 16 Jan 2022 14:33:56 +0200
Subject: [PATCH 13/30] chromium: rebuild for llvm13

---
 srcpkgs/chromium/template | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 2708747046d7..72167f73b8a5 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -20,7 +20,7 @@ desc_option_debug="Build with debug symbols"
 desc_option_js_optimize="Optimize the JS used for Chromium's UI"
 desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
 
-hostmakedepends="$(vopt_if clang "clang lld llvm12") python python3 pkgconf perl gperf bison ninja nodejs hwids
+hostmakedepends="$(vopt_if clang "clang lld llvm13") python python3 pkgconf perl gperf bison ninja nodejs hwids
  libatomic-devel libevent-devel libglib-devel $(vopt_if js_optimize openjdk) wayland-devel libepoxy-devel"
 makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
@@ -266,12 +266,6 @@ do_configure() {
 		'disable_fieldtrial_testing_config=true'
 
 		'is_official_build=true'
-
-		# segfaults with llvm-12.0.1
-		'is_cfi=false'
-		'use_thin_lto=false'
-		'use_cfi_icall=false'
-		'chrome_pgo_phase=0'
 	)
 
 	if [ "$CROSS_BUILD" ]; then

From cd518d57b53875c6e891d234083f36292644a445 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sun, 16 Jan 2022 14:39:04 +0200
Subject: [PATCH 14/30] llvm12: remove

---
 srcpkgs/llvm12/INSTALL.msg                    |   1 +
 .../llvm12/files/llvm-Config-llvm-config.h    |   9 --
 srcpkgs/llvm12/patches/llvm-001-musl.patch    |  57 ---------
 .../patches/llvm-002-musl-ppc64-elfv2.patch   |  30 -----
 .../patches/llvm-003-ppc-secureplt.patch      |  11 --
 .../patches/llvm-004-override-opt.patch       |  18 ---
 .../llvm12/patches/llvm-005-ppc-bigpic.patch  |  36 ------
 .../patches/llvm-006-aarch64-mf_exec.patch    |  25 ----
 srcpkgs/llvm12/template                       | 120 +-----------------
 srcpkgs/llvm12/update                         |   3 -
 10 files changed, 5 insertions(+), 305 deletions(-)
 create mode 100644 srcpkgs/llvm12/INSTALL.msg
 delete mode 100644 srcpkgs/llvm12/files/llvm-Config-llvm-config.h
 delete mode 100644 srcpkgs/llvm12/patches/llvm-001-musl.patch
 delete mode 100644 srcpkgs/llvm12/patches/llvm-002-musl-ppc64-elfv2.patch
 delete mode 100644 srcpkgs/llvm12/patches/llvm-003-ppc-secureplt.patch
 delete mode 100644 srcpkgs/llvm12/patches/llvm-004-override-opt.patch
 delete mode 100644 srcpkgs/llvm12/patches/llvm-005-ppc-bigpic.patch
 delete mode 100644 srcpkgs/llvm12/patches/llvm-006-aarch64-mf_exec.patch
 delete mode 100644 srcpkgs/llvm12/update

diff --git a/srcpkgs/llvm12/INSTALL.msg b/srcpkgs/llvm12/INSTALL.msg
new file mode 100644
index 000000000000..004acf7b530c
--- /dev/null
+++ b/srcpkgs/llvm12/INSTALL.msg
@@ -0,0 +1 @@
+llvm12 is no longer provided by Void Linux
diff --git a/srcpkgs/llvm12/files/llvm-Config-llvm-config.h b/srcpkgs/llvm12/files/llvm-Config-llvm-config.h
deleted file mode 100644
index 2fa08c9be696..000000000000
--- a/srcpkgs/llvm12/files/llvm-Config-llvm-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "llvm-config-32.h"
-#elif __WORDSIZE == 64
-#include "llvm-config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm12/patches/llvm-001-musl.patch b/srcpkgs/llvm12/patches/llvm-001-musl.patch
deleted file mode 100644
index f2a3f8d62813..000000000000
--- a/srcpkgs/llvm12/patches/llvm-001-musl.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:03:02 +0200
-Subject: [PATCH 3/3] musl
-
----
- include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
- lib/Support/DynamicLibrary.cpp            | 2 +-
- lib/Support/Unix/Signals.inc              | 6 +++---
- utils/unittest/googletest/src/gtest.cc    | 1 +
- 5 files changed, 17 insertions(+), 6 deletions(-)
-
-diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
-index 34a8a1e3..1214ece5 100644
---- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
-+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
-@@ -18,6 +18,15 @@
- #include "llvm/IR/PassManager.h"
- #include "llvm/Pass.h"
- 
-+#undef fopen64
-+#undef fseeko64
-+#undef fstat64
-+#undef fstatvfs64
-+#undef ftello64
-+#undef lstat64
-+#undef stat64
-+#undef tmpfile64
-+
- namespace llvm {
- template <typename T> class ArrayRef;
- class Triple;
-diff --git a/lib/Support/Unix/DynamicLibrary.inc b/lib/Support/Unix/DynamicLibrary.inc
-index a2a37996..2f86c470 100644
---- a/llvm/lib/Support/Unix/DynamicLibrary.inc
-+++ b/llvm/lib/Support/Unix/DynamicLibrary.inc
-@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
- 
- // This macro returns the address of a well-known, explicit symbol
- #define EXPLICIT_SYMBOL(SYM) \
--   if (!strcmp(SymbolName, #SYM)) return &SYM
-+   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
- 
- // Under glibc we have a weird situation. The stderr/out/in symbols are both
- // macros and global variables because of standards requirements. So, we
-diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
-index d882ab2e..f1fb12d0 100644
---- a/llvm/utils/unittest/googletest/src/gtest.cc
-+++ b/llvm/utils/unittest/googletest/src/gtest.cc
-@@ -128,6 +128,7 @@
- 
- #if GTEST_CAN_STREAM_RESULTS_
- # include <arpa/inet.h>  // NOLINT
-+# include <sys/socket.h>  // NOLINT
- # include <netdb.h>  // NOLINT
- # include <sys/socket.h>  // NOLINT
- # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm12/patches/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm12/patches/llvm-002-musl-ppc64-elfv2.patch
deleted file mode 100644
index 0071d964bd37..000000000000
--- a/srcpkgs/llvm12/patches/llvm-002-musl-ppc64-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
-need this because unlike most distros we use ELFv2 for both glibc and musl
-on big endian ppc64.
-
-diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp
-index 0634833e..b7cbc2e7 100644
---- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
-+++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
-@@ -222,9 +222,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
- 
-   switch (TT.getArch()) {
-   case Triple::ppc64le:
--    return PPCTargetMachine::PPC_ABI_ELFv2;
-   case Triple::ppc64:
--    return PPCTargetMachine::PPC_ABI_ELFv1;
-+    return PPCTargetMachine::PPC_ABI_ELFv2;
-   default:
-     return PPCTargetMachine::PPC_ABI_UNKNOWN;
-   }
-diff --git a/test/CodeGen/PowerPC/ppc64-elf-abi.ll b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
-index 8b1cf6b5..296a2afa 100644
---- a/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
-+++ b/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
-@@ -1,4 +1,5 @@
--; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
-+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
-+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
- ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
- ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
- ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm12/patches/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm12/patches/llvm-003-ppc-secureplt.patch
deleted file mode 100644
index b5d15974375d..000000000000
--- a/srcpkgs/llvm12/patches/llvm-003-ppc-secureplt.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-+++ b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -165,7 +165,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
-   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
-       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
--      TargetTriple.isMusl())
-+      isTargetLinux())
-     SecurePlt = true;
- 
-   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm12/patches/llvm-004-override-opt.patch b/srcpkgs/llvm12/patches/llvm-004-override-opt.patch
deleted file mode 100644
index 51d0e4b31b32..000000000000
--- a/srcpkgs/llvm12/patches/llvm-004-override-opt.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-This allows us to override the optimization level as not all platforms can
-deal with -O3.
-
---- a/llvm/CMakeLists.txt
-+++ b/llvm/CMakeLists.txt
-@@ -918,6 +918,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
-   llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
- endif()
- 
-+set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
-+
-+if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
-+    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
-+endif()
-+
- # Put this before tblgen. Else we have a circular dependence.
- add_subdirectory(lib/Demangle)
- add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm12/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm12/patches/llvm-005-ppc-bigpic.patch
deleted file mode 100644
index d332687b9d92..000000000000
--- a/srcpkgs/llvm12/patches/llvm-005-ppc-bigpic.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
-From: Samuel Holland <samuel@sholland.org>
-Date: Sun, 3 Nov 2019 10:57:27 -0600
-Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
-
----
- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
-index cce21f32..87ca5f9b 100644
---- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
-+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
-@@ -520,7 +520,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
- 
-   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
-   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
--      M->getPICLevel() == PICLevel::BigPIC)
-+      M->getPICLevel() != PICLevel::SmallPIC)
-     TlsRef = MCBinaryExpr::createAdd(
-         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
-   const MachineOperand &MO = MI->getOperand(2);
-diff --git a/lib/Target/PowerPC/PPCMCInstLower.cpp b/lib/Target/PowerPC/PPCMCInstLower.cpp
-index 5cc180d7..a5b02565 100644
---- a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
-+++ b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
-@@ -117,7 +117,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
-   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
-   // If -msecure-plt -fPIC, add 32768 to symbol.
-   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
--      M->getPICLevel() == PICLevel::BigPIC &&
-+      M->getPICLevel() != PICLevel::SmallPIC &&
-       MO.getTargetFlags() == PPCII::MO_PLT)
-     Expr =
-         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
diff --git a/srcpkgs/llvm12/patches/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm12/patches/llvm-006-aarch64-mf_exec.patch
deleted file mode 100644
index a00abd216665..000000000000
--- a/srcpkgs/llvm12/patches/llvm-006-aarch64-mf_exec.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
-
-    Failing Tests (8):
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
-
-Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
-
---- a/llvm/lib/Support/Unix/Memory.inc
-+++ b/llvm/lib/Support/Unix/Memory.inc
-@@ -58,7 +58,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
-     return PROT_READ | PROT_WRITE | PROT_EXEC;
-   case llvm::sys::Memory::MF_EXEC:
- #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
--     defined(_POWER) || defined(_ARCH_PPC))
-+     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
-     // On PowerPC, having an executable page that has no read permission
-     // can have unintended consequences.  The function InvalidateInstruction-
-     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm12/template b/srcpkgs/llvm12/template
index 7b361bbbf5bc..e7e40cae413e 100644
--- a/srcpkgs/llvm12/template
+++ b/srcpkgs/llvm12/template
@@ -1,125 +1,13 @@
 # Template file for 'llvm12'
 pkgname=llvm12
 version=12.0.1
-revision=3
-wrksrc="llvm-project-${version}.src"
-build_wrksrc=llvm
-build_style=cmake
-configure_args="
- -DCMAKE_BUILD_TYPE=Release -Wno-dev
- -DENABLE_LINKER_BUILD_ID=YES
- -DLLVM_INCLUDE_DOCS=YES
- -DLLVM_BUILD_DOCS=YES
- -DLLVM_ENABLE_SPHINX=YES
- -DSPHINX_WARNINGS_AS_ERRORS=NO
- -DLLVM_BUILD_LLVM_DYLIB=YES
- -DLLVM_LINK_LLVM_DYLIB=YES
- -DLLVM_ENABLE_RTTI=YES
- -DLLVM_ENABLE_FFI=YES
- -DLLVM_BINUTILS_INCDIR=/usr/include"
-hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
- python3-recommonmark python3-sphinx-automodapi"
-makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
- libxml2-devel binutils-devel libatomic-devel"
-depends="libllvm12>=${version}_${revision}"
-short_desc="Low Level Virtual Machine"
+revision=4
+build_style=meta
+short_desc="Low Level Virtual Machine (removed package)"
 maintainer="q66 <daniel@octaforge.org>"
-license="Apache-2.0"
+license="metapackage"
 homepage="https://www.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
-checksum=129cb25cd13677aad951ce5c2deb0fe4afc1e9d98950f53b51bdcfb5a73afa0e
-lib32disabled=yes
-python_version=3
-
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
-	makedepends+=" libexecinfo-devel"
-	depends+=" libexecinfo-devel"
-fi
-
-# "operand out of range" assembler failures
-case "$XBPS_TARGET_MACHINE" in
-	ppc64*) ;;
-	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
-esac
-
-post_patch() {
-	# update config.guess for better platform detection
-	cp $XBPS_COMMONDIR/environment/configure/automake/config.guess \
-		${wrksrc}/llvm/cmake
-}
-
-pre_configure() {
-	local triplet
-
-	# Vastly reduce size of debugging symbols:
-	CFLAGS=${CFLAGS/ -g/ -g1}
-	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
-
-	# since gcc9, the build likes to blow up for ppc32 apparently because
-	# of clang being too large for a 24-bit relative call to the PLT, so
-	# optimize for size instead
-	case "$XBPS_TARGET_MACHINE" in
-		ppc64*) ;;
-		mips*-musl|ppc*) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
-	esac
-
-	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-		make ${makejobs} -C utils/TableGen
-		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-		cd ../..
-	fi
-
-	case "$XBPS_TARGET_MACHINE" in
-		i686*) _arch="X86";;
-		x86_64*) _arch="X86";;
-		armv5*) _arch="Armv5te";;
-		armv6*) _arch="Armv6";;
-		armv7*) _arch="Armv7";;
-		aarch64*) _arch="AArch64";;
-		mips*) _arch="Mips";;
-		ppc*) _arch="PowerPC";;
-		riscv64*) _arch="RISCV64";;
-	esac
-
-	triplet=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}
-
-	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
-	configure_args+=" -DLLVM_HOST_TRIPLE=${triplet}"
-	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${triplet}"
-}
-
-do_install() {
-	cd build
-	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
-
-	# Required for multilib.
-	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
-		for _header in llvm-config; do
-			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
-			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
-				usr/include/llvm/Config ${_header}.h
-		done
-	fi
-
-	# Remove llvm-config-host in cross builds.
-	if [ "$CROSS_BUILD" ]; then
-		rm -f ${DESTDIR}/usr/bin/llvm-config-host
-	fi
-}
 
 libllvm12_package() {
 	short_desc+=" - runtime library"
-	pkg_install() {
-		vmove "usr/lib/libLLVM-*.so*"
-	}
 }
diff --git a/srcpkgs/llvm12/update b/srcpkgs/llvm12/update
deleted file mode 100644
index e95cf26b3586..000000000000
--- a/srcpkgs/llvm12/update
+++ /dev/null
@@ -1,3 +0,0 @@
-site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
-ignore="*-rc*"

From 819e3222a06069a68cae1355208638ef9fac47e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 28 Feb 2022 21:42:55 +0000
Subject: [PATCH 15/30] mesa: rebuild for llvm13

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index c90500de7416..8f08262fb135 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=21.3.7
-revision=1
+revision=2
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled

From bf3557dda17050158d61f484b5300330bf83f4a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 28 Feb 2022 21:43:56 +0000
Subject: [PATCH 16/30] qtcreator: update to 6.0.2.

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 988491ec6496..b166cc05a999 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -5,7 +5,7 @@ revision=1
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"
-hostmakedepends="clang llvm perl pkg-config python3 which qt5-qmake
+hostmakedepends="llvm13 perl pkg-config python3 which qt5-qmake
  qt5-host-tools"
 makedepends="qt5-declarative-devel qt5-script-devel qt5-tools-devel
  qt5-quickcontrols qt5-svg-devel clang llvm"

From b256d888235e2cda67a231db37448c1ff6b8c55c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 28 Feb 2022 21:46:48 +0000
Subject: [PATCH 17/30] ispc: update to 1.17.0.

---
 .../ispc/patches/cmake-build-type-none.patch  |   18 -
 srcpkgs/ispc/patches/llvm12-001.patch         |   57 -
 srcpkgs/ispc/patches/llvm12-002.patch         |  923 --------
 srcpkgs/ispc/patches/llvm12-003.patch         | 1504 ------------
 srcpkgs/ispc/patches/llvm12-004.patch         |   34 -
 srcpkgs/ispc/patches/llvm12-005.patch         |  372 ---
 srcpkgs/ispc/patches/llvm12-006.patch         |  126 -
 srcpkgs/ispc/patches/llvm12-007.patch         |  160 --
 srcpkgs/ispc/patches/llvm12-008.patch         |  149 --
 srcpkgs/ispc/patches/llvm12-009.patch         | 2109 -----------------
 srcpkgs/ispc/template                         |    8 +-
 11 files changed, 4 insertions(+), 5456 deletions(-)
 delete mode 100644 srcpkgs/ispc/patches/cmake-build-type-none.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-001.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-002.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-003.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-004.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-005.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-006.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-007.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-008.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-009.patch

diff --git a/srcpkgs/ispc/patches/cmake-build-type-none.patch b/srcpkgs/ispc/patches/cmake-build-type-none.patch
deleted file mode 100644
index 411e353c7314..000000000000
--- a/srcpkgs/ispc/patches/cmake-build-type-none.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Index: ispc-1.15.0/CMakeLists.txt
-===================================================================
---- ispc-1.15.0.orig/CMakeLists.txt
-+++ ispc-1.15.0/CMakeLists.txt
-@@ -157,13 +157,6 @@ set(OUTPUT_RELEASE Release/bin)
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin )
- 
- if(CMAKE_BUILD_TYPE)
--    # Validate build type
--    set(CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo")
--
--    string(FIND "${CONFIGURATION_TYPES}" "${CMAKE_BUILD_TYPE}" MATCHED_CONFIG)
--    if (${MATCHED_CONFIG} EQUAL -1)
--         message(FATAL_ERROR "CMAKE_BUILD_TYPE (${CMAKE_BUILD_TYPE}) allows only the following values: ${CONFIGURATION_TYPES}")
--    endif()
- else(NOT CMAKE_BUILD_TYPE)
-     set(CMAKE_BUILD_TYPE "Release")
-     message(STATUS "Build type not specified: Use Release by default.")
diff --git a/srcpkgs/ispc/patches/llvm12-001.patch b/srcpkgs/ispc/patches/llvm12-001.patch
deleted file mode 100644
index 5f2d3f5a409e..000000000000
--- a/srcpkgs/ispc/patches/llvm12-001.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 1c0f89dccb774f216c7f6e76a99ee907a1e641cb Mon Sep 17 00:00:00 2001
-From: Dmitry Babokin <dmitry.y.babokin@intel.com>
-Date: Tue, 22 Dec 2020 17:03:59 -0800
-Subject: [PATCH] Fix to work with LLVM trunk after llvm/llvm-project@41c3b2713
-
----
- src/ctx.cpp | 18 ++++++++++++------
- 1 file changed, 12 insertions(+), 6 deletions(-)
-
-diff --git a/src/ctx.cpp b/src/ctx.cpp
-index 6fbb8b9cf..977e9d222 100644
---- a/src/ctx.cpp
-+++ b/src/ctx.cpp
-@@ -1473,11 +1473,15 @@ void FunctionEmitContext::AddDebugPos(llvm::Value *value, const SourcePos *pos,
-     llvm::Instruction *inst = llvm::dyn_cast<llvm::Instruction>(value);
-     if (inst != NULL && m->diBuilder) {
-         SourcePos p = pos ? *pos : currentPos;
--        if (p.first_line != 0)
-+        if (p.first_line != 0) {
-             // If first_line == 0, then we're in the middle of setting up
-             // the standard library or the like; don't add debug positions
-             // for those functions
--            inst->setDebugLoc(llvm::DebugLoc::get(p.first_line, p.first_column, scope ? scope : GetDIScope()));
-+            scope = scope ? scope : GetDIScope();
-+            llvm::DebugLoc diLoc =
-+                llvm::DILocation::get(scope->getContext(), p.first_line, p.first_column, scope, nullptr, false);
-+            inst->setDebugLoc(diLoc);
-+        }
-     }
- }
- 
-@@ -1518,9 +1522,10 @@ void FunctionEmitContext::EmitVariableDebugInfo(Symbol *sym) {
-     llvm::DILocalVariable *var = m->diBuilder->createAutoVariable(
-         scope, sym->name, sym->pos.GetDIFile(), sym->pos.first_line, diType, true /* preserve through opts */);
- 
-+    llvm::DebugLoc diLoc =
-+        llvm::DILocation::get(scope->getContext(), sym->pos.first_line, sym->pos.first_column, scope, nullptr, false);
-     llvm::Instruction *declareInst =
--        m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(),
--                                    llvm::DebugLoc::get(sym->pos.first_line, sym->pos.first_column, scope), bblock);
-+        m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(), diLoc, bblock);
-     AddDebugPos(declareInst, &sym->pos, scope);
- }
- 
-@@ -1535,9 +1540,10 @@ void FunctionEmitContext::EmitFunctionParameterDebugInfo(Symbol *sym, int argNum
-         m->diBuilder->createParameterVariable(scope, sym->name, argNum + 1, sym->pos.GetDIFile(), sym->pos.first_line,
-                                               diType, true /* preserve through opts */, flags);
- 
-+    llvm::DebugLoc diLoc =
-+        llvm::DILocation::get(scope->getContext(), sym->pos.first_line, sym->pos.first_column, scope, nullptr, false);
-     llvm::Instruction *declareInst =
--        m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(),
--                                    llvm::DebugLoc::get(sym->pos.first_line, sym->pos.first_column, scope), bblock);
-+        m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(), diLoc, bblock);
-     AddDebugPos(declareInst, &sym->pos, scope);
- }
- 
diff --git a/srcpkgs/ispc/patches/llvm12-002.patch b/srcpkgs/ispc/patches/llvm12-002.patch
deleted file mode 100644
index 0903f30da10d..000000000000
--- a/srcpkgs/ispc/patches/llvm12-002.patch
+++ /dev/null
@@ -1,923 +0,0 @@
-From 0597a79d084c014780136da906afe21d15e982cb Mon Sep 17 00:00:00 2001
-From: DeepakRajendrakumaran <deepak.rajendrakumaran@intel.com>
-Date: Tue, 5 Jan 2021 13:53:30 -0800
-Subject: [PATCH] Remove LLVM 8.0 and LLVM 9.0. (#1966)
-
----
- .appveyor.yml                        |  3 --
- .travis.yml                          |  7 ---
- CMakeLists.txt                       | 12 ++----
- src/ast.cpp                          |  4 --
- src/ctx.cpp                          | 30 -------------
- src/gen/GlobalsLocalization.cpp      |  4 --
- src/ispc.cpp                         | 20 ---------
- src/ispc.h                           |  3 +-
- src/ispc_version.h                   |  4 +-
- src/main.cpp                         | 13 ------
- src/module.cpp                       | 27 ------------
- src/module.h                         |  2 -
- src/opt.cpp                          | 64 ++--------------------------
- src/type.cpp                         | 10 ++---
- tests/lit-tests/1771.ispc            |  1 -
- tests/lit-tests/1844.ispc            |  3 --
- tests/lit-tests/1926.ispc            |  2 -
- tests/lit-tests/cpus_x86.ispc        |  2 +
- tests/lit-tests/cpus_x86_llvm10.ispc | 11 -----
- tests/lit-tests/lit.cfg              |  5 ---
- 20 files changed, 14 insertions(+), 213 deletions(-)
- delete mode 100644 tests/lit-tests/cpus_x86_llvm10.ispc
-
-diff --git a/.appveyor.yml b/.appveyor.yml
-index 451a7b3e0..7945cca2a 100644
---- a/.appveyor.yml
-+++ b/.appveyor.yml
-@@ -41,8 +41,6 @@ environment:
-       LLVM_VERSION: latest
-     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
-       LLVM_VERSION: 10.0
--    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
--      LLVM_VERSION: 9.0
- 
- for:
- -
-@@ -62,7 +60,6 @@ for:
-         if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" ( (set generator="Visual Studio 16") & (set vsversion=2019))
-         set LLVM_TAR=llvm-11.0.0-win.vs2019-Release+Asserts-x86.arm.wasm.7z
-         if "%LLVM_VERSION%"=="10.0" (set LLVM_TAR=llvm-10.0.1-win.vs2019-Release+Asserts-x86.arm.wasm.zip)
--        if "%LLVM_VERSION%"=="9.0" (set LLVM_TAR=llvm-9.0.1-win.vs2017-Release+Asserts-x86.arm.wasm.zip)
-   install:
-     - ps: choco install --no-progress winflexbison3 wget 7zip
-     - cmd: |-
-diff --git a/.travis.yml b/.travis.yml
-index 2e96017a6..3a6b85264 100644
---- a/.travis.yml
-+++ b/.travis.yml
-@@ -108,13 +108,6 @@ jobs:
-         - LLVM_TAR=llvm-10.0.1-ubuntu16.04-Release+Asserts-x86.arm.wasm.tar.xz
-         - LLVM_REPO=https://github.com/dbabokin/llvm-project
-         - ISPC_HOME=$TRAVIS_BUILD_DIR
--    # LLVM 9.0 + Ubuntu 16.04: build, lit tests, examples (build + run), benchmarks (build + trial run)
--    - <<: *my_tag
--      env:
--        - LLVM_VERSION=9.0 OS=Ubuntu16.04
--        - LLVM_TAR=llvm-9.0.1-ubuntu16.04-Release+Asserts-x86.arm.wasm.tar.xz
--        - LLVM_REPO=https://github.com/dbabokin/llvm-project
--        - ISPC_HOME=$TRAVIS_BUILD_DIR
-     # WASM enabled build
-     # LLVM 11.0 + Ubuntu 16.04: build, lit tests, examples (build), benchmarks (build + trial run)
-     - <<: *my_tag
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 5fa863fcf..a6b3ed251 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -241,10 +241,8 @@ if (X86_ENABLED)
-         avx2-i8x32 avx2-i16x16
-         avx2-i32x4 avx2-i32x8 avx2-i32x16 avx2-i64x4
-         avx512knl-i32x16
--        avx512skx-i32x16 avx512skx-i32x8)
--    if (${LLVM_VERSION_NUMBER} VERSION_GREATER_EQUAL "10.0.0")
--        list(APPEND ISPC_TARGETS avx512skx-i8x64 avx512skx-i16x32)
--    endif()
-+        avx512skx-i32x16 avx512skx-i32x8
-+        avx512skx-i8x64 avx512skx-i16x32)
- endif()
- if (ARM_ENABLED)
-     list(APPEND ISPC_TARGETS neon-i8x16 neon-i16x8 neon-i32x4 neon-i32x8)
-@@ -259,11 +257,7 @@ if (WASM_ENABLED)
- endif()
- 
- set(CLANG_LIBRARY_LIST clangFrontend clangDriver clangSerialization clangParse clangSema clangAnalysis clangAST clangBasic clangEdit clangLex)
--set(LLVM_COMPONENTS engine ipo bitreader bitwriter instrumentation linker option)
--
--if (${LLVM_VERSION_NUMBER} VERSION_GREATER_EQUAL "10.0.0")
--    list(APPEND LLVM_COMPONENTS frontendopenmp)
--endif()
-+set(LLVM_COMPONENTS engine ipo bitreader bitwriter instrumentation linker option frontendopenmp)
- 
- if (X86_ENABLED)
-     list(APPEND LLVM_COMPONENTS x86)
-diff --git a/src/ast.cpp b/src/ast.cpp
-index 20f75a29c..5a43c4854 100644
---- a/src/ast.cpp
-+++ b/src/ast.cpp
-@@ -44,9 +44,7 @@
- #include "sym.h"
- #include "util.h"
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
- #include <llvm/Support/TimeProfiler.h>
--#endif
- ///////////////////////////////////////////////////////////////////////////
- // ASTNode
- 
-@@ -62,9 +60,7 @@ void AST::AddFunction(Symbol *sym, Stmt *code) {
- }
- 
- void AST::GenerateIR() {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope TimeScope("GenerateIR");
--#endif
-     for (unsigned int i = 0; i < functions.size(); ++i)
-         functions[i]->GenerateIR();
- }
-diff --git a/src/ctx.cpp b/src/ctx.cpp
-index 977e9d222..42c4ea09d 100644
---- a/src/ctx.cpp
-+++ b/src/ctx.cpp
-@@ -309,21 +309,13 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym, llvm::F
-             char buf[256];
-             snprintf(buf, sizeof(buf), "__off_all_on_mask_%s", g->target->GetISAString());
- 
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_8_0
--            llvm::Constant *offFunc = m->module->getOrInsertFunction(buf, LLVMTypes::VoidType);
--#else // LLVM 9.0+
-             llvm::FunctionCallee offFuncCallee = m->module->getOrInsertFunction(buf, LLVMTypes::VoidType);
-             llvm::Constant *offFunc = llvm::cast<llvm::Constant>(offFuncCallee.getCallee());
--#endif
-             AssertPos(currentPos, llvm::isa<llvm::Function>(offFunc));
-             llvm::BasicBlock *offBB = llvm::BasicBlock::Create(*g->ctx, "entry", (llvm::Function *)offFunc, 0);
-             llvm::StoreInst *inst = new llvm::StoreInst(LLVMMaskAllOff, globalAllOnMaskPtr, offBB);
-             if (g->opt.forceAlignedMemory) {
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--                inst->setAlignment(g->target->getNativeVectorAlignment());
--#else // LLVM 10.0+
-                 inst->setAlignment(llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne());
--#endif
-             }
-             llvm::ReturnInst::Create(*g->ctx, offBB);
-         }
-@@ -2288,11 +2280,7 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, const Type *type, c
- #endif
- 
-     if (g->opt.forceAlignedMemory && llvm::dyn_cast<llvm::VectorType>(pt->getElementType())) {
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--        inst->setAlignment(g->target->getNativeVectorAlignment());
--#else // LLVM 10.0+
-         inst->setAlignment(llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne());
--#endif
-     }
- 
-     AddDebugPos(inst);
-@@ -2431,11 +2419,7 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
-                 // vs the proper alignment in practice.)
-                 int align = 1;
- 
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--                inst->setAlignment(align);
--#else // LLVM 10.0+
-                 inst->setAlignment(llvm::MaybeAlign(align).valueOrOne());
--#endif
-             }
- 
-             AddDebugPos(inst);
-@@ -2649,11 +2633,7 @@ llvm::Value *FunctionEmitContext::AllocaInst(llvm::Type *llvmType, const char *n
-         align = g->target->getNativeVectorAlignment();
- 
-     if (align != 0) {
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--        inst->setAlignment(align);
--#else // LLVM 10.0+
-         inst->setAlignment(llvm::MaybeAlign(align).valueOrOne());
--#endif
-     }
-     // Don't add debugging info to alloca instructions
-     return inst;
-@@ -2926,11 +2906,7 @@ void FunctionEmitContext::StoreInst(llvm::Value *value, llvm::Value *ptr, const
-     llvm::StoreInst *inst = new llvm::StoreInst(value, ptr, bblock);
- 
-     if (g->opt.forceAlignedMemory && llvm::dyn_cast<llvm::VectorType>(pt->getElementType())) {
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--        inst->setAlignment(g->target->getNativeVectorAlignment());
--#else // LLVM 10.0+
-         inst->setAlignment(llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne());
--#endif
-     }
- 
- #ifdef ISPC_GENX_ENABLED
-@@ -3025,16 +3001,10 @@ void FunctionEmitContext::MemcpyInst(llvm::Value *dest, llvm::Value *src, llvm::
-     }
-     if (align == NULL)
-         align = LLVMInt32(1);
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_8_0
--    llvm::Constant *mcFunc =
--        m->module->getOrInsertFunction("llvm.memcpy.p0i8.p0i8.i64", LLVMTypes::VoidType, LLVMTypes::VoidPointerType,
--                                       LLVMTypes::VoidPointerType, LLVMTypes::Int64Type, LLVMTypes::BoolType);
--#else // LLVM 9.0+
-     llvm::FunctionCallee mcFuncCallee =
-         m->module->getOrInsertFunction("llvm.memcpy.p0i8.p0i8.i64", LLVMTypes::VoidType, LLVMTypes::VoidPointerType,
-                                        LLVMTypes::VoidPointerType, LLVMTypes::Int64Type, LLVMTypes::BoolType);
-     llvm::Constant *mcFunc = llvm::cast<llvm::Constant>(mcFuncCallee.getCallee());
--#endif
-     AssertPos(currentPos, mcFunc != NULL);
-     AssertPos(currentPos, llvm::isa<llvm::Function>(mcFunc));
- 
-diff --git a/src/gen/GlobalsLocalization.cpp b/src/gen/GlobalsLocalization.cpp
-index 193a66289..a176e9462 100644
---- a/src/gen/GlobalsLocalization.cpp
-+++ b/src/gen/GlobalsLocalization.cpp
-@@ -470,11 +470,7 @@ void GlobalsLocalization::LocalizeGlobals(LocalizationInfo &LI) {
-         Instruction &FirstI = *Fn->getEntryBlock().begin();
-         Type *ElemTy = GV->getType()->getElementType();
-         AllocaInst *Alloca = new AllocaInst(ElemTy, 0, GV->getName() + ".local", &FirstI);
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--        Alloca->setAlignment(GV->getAlignment());
--#else // LLVM 10.0+
-         Alloca->setAlignment(llvm::MaybeAlign(GV->getAlignment()));
--#endif
-         if (!isa<UndefValue>(GV->getInitializer()))
-             new StoreInst(GV->getInitializer(), Alloca, &FirstI);
- 
-diff --git a/src/ispc.cpp b/src/ispc.cpp
-index e2d0f206e..fac5233f7 100644
---- a/src/ispc.cpp
-+++ b/src/ispc.cpp
-@@ -272,9 +272,7 @@ typedef enum {
-     CPU_Silvermont,
- 
-     CPU_ICX,
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     CPU_TGL,
--#endif
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_12_0
-     CPU_ADL,
-     CPU_SPR,
-@@ -365,10 +363,8 @@ class AllCPUs {
- 
-         names[CPU_ICX].push_back("icelake-server");
-         names[CPU_ICX].push_back("icx");
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         names[CPU_TGL].push_back("tigerlake");
-         names[CPU_TGL].push_back("tgl");
--#endif
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_12_0
-         names[CPU_ADL].push_back("alderlake");
-         names[CPU_ADL].push_back("adl");
-@@ -411,11 +407,9 @@ class AllCPUs {
-         compat[CPU_ADL] = Set(CPU_ADL, CPU_x86_64, CPU_Bonnell, CPU_Penryn, CPU_Core2, CPU_Nehalem, CPU_Silvermont,
-                               CPU_SandyBridge, CPU_IvyBridge, CPU_Haswell, CPU_Broadwell, CPU_None);
- #endif
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         compat[CPU_TGL] =
-             Set(CPU_TGL, CPU_x86_64, CPU_Bonnell, CPU_Penryn, CPU_Core2, CPU_Nehalem, CPU_Silvermont, CPU_SandyBridge,
-                 CPU_IvyBridge, CPU_Haswell, CPU_Broadwell, CPU_SKX, CPU_ICL, CPU_ICX, CPU_None);
--#endif
-         compat[CPU_ICX] = Set(CPU_ICX, CPU_x86_64, CPU_Bonnell, CPU_Penryn, CPU_Core2, CPU_Nehalem, CPU_Silvermont,
-                               CPU_SandyBridge, CPU_IvyBridge, CPU_Haswell, CPU_Broadwell, CPU_SKX, CPU_ICL, CPU_None);
- 
-@@ -556,9 +550,7 @@ Target::Target(Arch arch, const char *cpu, ISPCTarget ispc_target, bool pic, boo
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_12_0
-         case CPU_SPR:
- #endif
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         case CPU_TGL:
--#endif
-         case CPU_ICX:
-         case CPU_ICL:
-         case CPU_SKX:
-@@ -916,7 +908,6 @@ Target::Target(Arch arch, const char *cpu, ISPCTarget ispc_target, bool pic, boo
-         }
-         break;
-     case ISPCTarget::avx512skx_i8x64:
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0 // LLVM 10.0+
-         // This target is enabled only for LLVM 10.0 and later
-         // because LLVM requires a number of fixes, which are
-         // committed to LLVM 11.0 and can be applied to 10.0, but not
-@@ -937,12 +928,7 @@ Target::Target(Arch arch, const char *cpu, ISPCTarget ispc_target, bool pic, boo
-         this->m_hasVecPrefetch = false;
-         CPUfromISA = CPU_SKX;
-         break;
--#else
--        unsupported_target = true;
--        break;
--#endif
-     case ISPCTarget::avx512skx_i16x32:
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0 // LLVM 10.0+
-         // This target is enabled only for LLVM 10.0 and later
-         // because LLVM requires a number of fixes, which are
-         // committed to LLVM 11.0 and can be applied to 10.0, but not
-@@ -963,10 +949,6 @@ Target::Target(Arch arch, const char *cpu, ISPCTarget ispc_target, bool pic, boo
-         this->m_hasVecPrefetch = false;
-         CPUfromISA = CPU_SKX;
-         break;
--#else
--        unsupported_target = true;
--        break;
--#endif
- #ifdef ISPC_ARM_ENABLED
-     case ISPCTarget::neon_i8x16:
-         this->m_isa = Target::NEON;
-@@ -1662,11 +1644,9 @@ Globals::Globals() {
-     isMultiTargetCompilation = false;
-     errorLimit = -1;
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     enableTimeTrace = false;
-     // set default granularity to 500.
-     timeTraceGranularity = 500;
--#endif
-     target = NULL;
-     ctx = new llvm::LLVMContext;
- 
-diff --git a/src/ispc.h b/src/ispc.h
-index e25d8830e..de357a21c 100644
---- a/src/ispc.h
-+++ b/src/ispc.h
-@@ -695,13 +695,12 @@ struct Globals {
- 
-     /* Number of errors to show in ISPC. */
-     int errorLimit;
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-+
-     /* When true, enable compile time tracing. */
-     bool enableTimeTrace;
- 
-     /* When compile time tracing is enabled, set time granularity. */
-     int timeTraceGranularity;
--#endif
- };
- 
- enum {
-diff --git a/src/ispc_version.h b/src/ispc_version.h
-index d781347fd..434b2d678 100644
---- a/src/ispc_version.h
-+++ b/src/ispc_version.h
-@@ -44,13 +44,11 @@
- 
- #define ISPC_LLVM_VERSION (LLVM_VERSION_MAJOR * 10000 + LLVM_VERSION_MINOR * 100)
- 
--#define ISPC_LLVM_8_0 80000
--#define ISPC_LLVM_9_0 90000
- #define ISPC_LLVM_10_0 100000
- #define ISPC_LLVM_11_0 110000
- #define ISPC_LLVM_12_0 120000
- 
--#define OLDEST_SUPPORTED_LLVM ISPC_LLVM_8_0
-+#define OLDEST_SUPPORTED_LLVM ISPC_LLVM_10_0
- #define LATEST_SUPPORTED_LLVM ISPC_LLVM_12_0
- 
- #ifdef __ispc__xstr
-diff --git a/src/main.cpp b/src/main.cpp
-index 8f64330cc..5c920eabc 100644
---- a/src/main.cpp
-+++ b/src/main.cpp
-@@ -55,9 +55,7 @@
- #include <llvm/Support/Signals.h>
- #include <llvm/Support/TargetRegistry.h>
- #include <llvm/Support/TargetSelect.h>
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
- #include <llvm/Support/ToolOutputFile.h>
--#endif
- 
- #ifdef ISPC_HOST_IS_WINDOWS
- #define strcasecmp stricmp
-@@ -181,11 +179,9 @@ static void lPrintVersion() {
-     snprintf(targetHelp, sizeof(targetHelp), "[--target-os=<os>]\t\t\tSelect target OS.  <os>={%s}",
-              g->target_registry->getSupportedOSes().c_str());
-     PrintWithWordBreaks(targetHelp, 24, TerminalWidth(), stdout);
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     printf("    [--time-trace]\t\t\tTurn on time profiler. Generates JSON file based on output filename.\n");
-     printf("    [--time-trace-granularity=<value>\tMinimum time granularity (in microseconds) traced by time "
-            "profiler.\n");
--#endif
-     printf("    [--version]\t\t\t\tPrint ispc version\n");
- #ifdef ISPC_GENX_ENABLED
-     printf("    [--vc-options=<\"-option1 -option2...\">]\t\t\t\tPass additional options to Vector Compiler backend\n");
-@@ -462,7 +458,6 @@ static void setCallingConv(VectorCallStatus vectorCall, Arch arch) {
-     }
- }
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
- static void writeCompileTimeFile(const char *outFileName) {
-     llvm::SmallString<128> jsonFileName(outFileName);
-     jsonFileName.append(".json");
-@@ -479,7 +474,6 @@ static void writeCompileTimeFile(const char *outFileName) {
-     of->keep();
-     return;
- }
--#endif
- 
- static std::set<int> ParsingPhases(char *stages, ArgErrors &errorHandler) {
-     constexpr int parsing_limit = 100;
-@@ -791,12 +785,10 @@ int main(int Argc, char *Argv[]) {
-             }
-         } else if (!strncmp(argv[i], "--force-alignment=", 18)) {
-             g->forceAlignment = atoi(argv[i] + 18);
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         } else if (!strcmp(argv[i], "--time-trace")) {
-             g->enableTimeTrace = true;
-         } else if (!strncmp(argv[i], "--time-trace-granularity=", 25)) {
-             g->timeTraceGranularity = atoi(argv[i] + 25);
--#endif
-         } else if (!strcmp(argv[i], "--woff") || !strcmp(argv[i], "-woff")) {
-             g->disableWarnings = true;
-             g->emitPerfWarnings = false;
-@@ -1059,7 +1051,6 @@ int main(int Argc, char *Argv[]) {
- 
-     // This needs to happen after the TargetOS is decided.
-     setCallingConv(vectorCall, arch);
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     if (g->enableTimeTrace) {
-         llvm::timeTraceProfilerInitialize(g->timeTraceGranularity, "ispc");
-     }
-@@ -1077,9 +1068,5 @@ int main(int Argc, char *Argv[]) {
-         }
-         llvm::timeTraceProfilerCleanup();
-     }
--#else
--    int ret = Module::CompileAndOutput(file, arch, cpu, targets, flags, ot, outFileName, headerFileName, depsFileName,
--                                       depsTargetName, hostStubFileName, devStubFileName);
--#endif
-     return ret;
- }
-diff --git a/src/module.cpp b/src/module.cpp
-index fe7452df1..a85fec77a 100644
---- a/src/module.cpp
-+++ b/src/module.cpp
-@@ -170,9 +170,7 @@ Module::Module(const char *fn) {
-     module->setDataLayout(g->target->getDataLayout()->getStringRepresentation());
- 
-     if (g->generateDebuggingSymbols) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         llvm::TimeTraceScope TimeScope("Create Debug Data");
--#endif
-         // To enable debug information on Windows, we have to let llvm know, that
-         // debug information should be emitted in CodeView format.
-         if (g->target_os == TargetOS::windows) {
-@@ -226,10 +224,8 @@ extern YY_BUFFER_STATE yy_create_buffer(FILE *, int);
- extern void yy_delete_buffer(YY_BUFFER_STATE);
- 
- int Module::CompileFile() {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope CompileFileTimeScope(
-         "CompileFile", llvm::StringRef(filename + ("_" + std::string(g->target->GetISAString()))));
--#endif
-     extern void ParserInit();
-     ParserInit();
- 
-@@ -238,18 +234,14 @@ int Module::CompileFile() {
-     // variable 'm' to be initialized and available (which it isn't until
-     // the Module constructor returns...)
-     {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         llvm::TimeTraceScope TimeScope("DefineStdlib");
--#endif
-         DefineStdlib(symbolTable, g->ctx, module, g->includeStdlib);
-     }
- 
-     bool runPreprocessor = g->runCPP;
- 
-     if (runPreprocessor) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         llvm::TimeTraceScope TimeScope("Frontend parser");
--#endif
-         if (!IsStdin(filename)) {
-             // Try to open the file first, since otherwise we crash in the
-             // preprocessor if the file doesn't exist.
-@@ -268,9 +260,7 @@ int Module::CompileFile() {
-         yyparse();
-         yy_delete_buffer(strbuf);
-     } else {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         llvm::TimeTraceScope TimeScope("Frontend parser");
--#endif
-         // No preprocessor, just open up the file if it's not stdin..
-         FILE *f = NULL;
-         if (IsStdin(filename)) {
-@@ -297,9 +287,7 @@ int Module::CompileFile() {
- 
-     if (diBuilder)
-         diBuilder->finalize();
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope TimeScope("Optimize");
--#endif
-     if (errorCount == 0)
-         Optimize(module, g->opt.level);
- 
-@@ -1243,15 +1231,8 @@ bool Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine, llvm:
-                                        const char *outFileName) {
-     // Figure out if we're generating object file or assembly output, and
-     // set binary output for object files
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--    Assert(!g->target->isGenXTarget());
--    llvm::TargetMachine::CodeGenFileType fileType =
--        (outputType == Object) ? llvm::TargetMachine::CGFT_ObjectFile : llvm::TargetMachine::CGFT_AssemblyFile;
--    bool binary = (fileType == llvm::TargetMachine::CGFT_ObjectFile);
--#else // LLVM 10.0+
-     llvm::CodeGenFileType fileType = (outputType == Object) ? llvm::CGFT_ObjectFile : llvm::CGFT_AssemblyFile;
-     bool binary = (fileType == llvm::CGFT_ObjectFile);
--#endif
- 
-     llvm::sys::fs::OpenFlags flags = binary ? llvm::sys::fs::F_None : llvm::sys::fs::F_Text;
- 
-@@ -2219,11 +2200,7 @@ void Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *
-     inst.setTarget(target);
-     inst.createSourceManager(inst.getFileManager());
- 
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--    clang::FrontendInputFile inputFile(infilename, clang::InputKind::Unknown);
--#else // LLVM 10.0+
-     clang::FrontendInputFile inputFile(infilename, clang::InputKind());
--#endif
- 
-     inst.InitializeSourceManager(inputFile);
- 
-@@ -2722,9 +2699,7 @@ int Module::CompileAndOutput(const char *srcFile, Arch arch, const char *cpu, st
- 
-         m = new Module(srcFile);
-         if (m->CompileFile() == 0) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-             llvm::TimeTraceScope TimeScope("Backend");
--#endif
- #ifdef ISPC_GENX_ENABLED
-             if (outputType == Asm || outputType == Object) {
-                 if (g->target->isGenXTarget()) {
-@@ -2855,9 +2830,7 @@ int Module::CompileAndOutput(const char *srcFile, Arch arch, const char *cpu, st
- 
-             m = new Module(srcFile);
-             int compileFileError = m->CompileFile();
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-             llvm::TimeTraceScope TimeScope("Backend");
--#endif
-             if (compileFileError == 0) {
-                 // Create the dispatch module, unless already created;
-                 // in the latter case, just do the checking
-diff --git a/src/module.h b/src/module.h
-index 61d3cfea0..603124d50 100644
---- a/src/module.h
-+++ b/src/module.h
-@@ -43,9 +43,7 @@
- 
- #include <llvm/IR/DebugInfo.h>
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
- #include <llvm/Support/TimeProfiler.h>
--#endif
- 
- #ifdef ISPC_GENX_ENABLED
- #include "ocl_igc_interface/igc_ocl_device_ctx.h"
-diff --git a/src/opt.cpp b/src/opt.cpp
-index a655a8344..5b1ac7b63 100644
---- a/src/opt.cpp
-+++ b/src/opt.cpp
-@@ -66,6 +66,7 @@
- #include <llvm/IR/Instructions.h>
- #include <llvm/IR/IntrinsicInst.h>
- #include <llvm/IR/Intrinsics.h>
-+#include <llvm/IR/IntrinsicsX86.h>
- #include <llvm/IR/LegacyPassManager.h>
- #include <llvm/IR/Module.h>
- #include <llvm/IR/PatternMatch.h>
-@@ -85,9 +86,6 @@
- #include <llvm/Transforms/Scalar/InstSimplifyPass.h>
- #include <llvm/Transforms/Utils.h>
- #include <llvm/Transforms/Utils/BasicBlockUtils.h>
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
--#include <llvm/IR/IntrinsicsX86.h>
--#endif
- 
- #ifdef ISPC_HOST_IS_LINUX
- #include <alloca.h>
-@@ -1003,10 +1001,7 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
-                 else
-                     align = callInst->getCalledFunction() == avxMaskedLoad32 ? 4 : 8;
-                 name = LLVMGetName(callInst->getArgOperand(0), "_load");
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--                llvm::Instruction *loadInst =
--                    new llvm::LoadInst(castPtr, name, false /* not volatile */, align, (llvm::Instruction *)NULL);
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-+#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-                 llvm::Instruction *loadInst = new llvm::LoadInst(castPtr, name, false /* not volatile */,
-                                                                  llvm::MaybeAlign(align), (llvm::Instruction *)NULL);
- #else
-@@ -1043,13 +1038,8 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
-                     align = g->target->getNativeVectorAlignment();
-                 else
-                     align = callInst->getCalledFunction() == avxMaskedStore32 ? 4 : 8;
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--                llvm::StoreInst *storeInst = new llvm::StoreInst(rvalue, castPtr, (llvm::Instruction *)NULL);
--                storeInst->setAlignment(align);
--#else
-                 llvm::StoreInst *storeInst = new llvm::StoreInst(rvalue, castPtr, (llvm::Instruction *)NULL,
-                                                                  llvm::MaybeAlign(align).valueOrOne());
--#endif
-                 lCopyMetadata(storeInst, callInst);
-                 llvm::ReplaceInstWithInst(callInst, storeInst);
- 
-@@ -1066,9 +1056,7 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool IntrinsicsOpt::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("IntrinsicsOpt::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -1239,9 +1227,7 @@ bool InstructionSimplifyPass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool InstructionSimplifyPass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("InstructionSimplifyPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -2974,16 +2960,10 @@ static bool lImproveMaskedStore(llvm::CallInst *callInst) {
- 
-             lvalue = new llvm::BitCastInst(lvalue, ptrType, "lvalue_to_ptr_type", callInst);
-             lCopyMetadata(lvalue, callInst);
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--            store =
--                new llvm::StoreInst(rvalue, lvalue, false /* not volatile */,
--                                    g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align);
--#else
-             store = new llvm::StoreInst(
-                 rvalue, lvalue, false /* not volatile */,
-                 llvm::MaybeAlign(g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align)
-                     .valueOrOne());
--#endif
-         }
-         if (store != NULL) {
-             lCopyMetadata(store, callInst);
-@@ -3059,11 +3039,7 @@ static bool lImproveMaskedLoad(llvm::CallInst *callInst, llvm::BasicBlock::itera
-         {
-             llvm::Type *ptrType = llvm::PointerType::get(callInst->getType(), 0);
-             ptr = new llvm::BitCastInst(ptr, ptrType, "ptr_cast_for_load", callInst);
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--            load = new llvm::LoadInst(ptr, callInst->getName(), false /* not volatile */,
--                                      g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align,
--                                      (llvm::Instruction *)NULL);
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-+#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-             load = new llvm::LoadInst(
-                 ptr, callInst->getName(), false /* not volatile */,
-                 llvm::MaybeAlign(g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align)
-@@ -3129,9 +3105,7 @@ bool ImproveMemoryOpsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool ImproveMemoryOpsPass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("ImproveMemoryOpsPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -3424,9 +3398,7 @@ llvm::Value *lGEPAndLoad(llvm::Value *basePtr, int64_t offset, int align, llvm::
-                          llvm::Type *type) {
-     llvm::Value *ptr = lGEPInst(basePtr, LLVMInt64(offset), "new_base", insertBefore);
-     ptr = new llvm::BitCastInst(ptr, llvm::PointerType::get(type, 0), "ptr_cast", insertBefore);
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--    return new llvm::LoadInst(ptr, "gather_load", false /* not volatile */, align, insertBefore);
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-+#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-     return new llvm::LoadInst(ptr, "gather_load", false /* not volatile */, llvm::MaybeAlign(align), insertBefore);
- #else // LLVM 11.0+
-     return new llvm::LoadInst(llvm::dyn_cast<llvm::PointerType>(ptr->getType())->getPointerElementType(), ptr,
-@@ -4135,9 +4107,7 @@ bool GatherCoalescePass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool GatherCoalescePass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("GatherCoalescePass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -4467,9 +4437,7 @@ bool ReplacePseudoMemoryOpsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool ReplacePseudoMemoryOpsPass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("ReplacePseudoMemoryOpsPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -4573,9 +4541,7 @@ bool IsCompileTimeConstantPass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool IsCompileTimeConstantPass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("IsCompileTimeConstantPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -5201,9 +5167,7 @@ bool PeepholePass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool PeepholePass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("PeepholePass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -5299,9 +5263,7 @@ bool ReplaceStdlibShiftPass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool ReplaceStdlibShiftPass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("ReplaceStdlibShiftPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -5399,9 +5361,7 @@ llvm::Instruction *FixBooleanSelectPass::fixSelect(llvm::SelectInst *sel, llvm::
- }
- 
- bool FixBooleanSelectPass::runOnFunction(llvm::Function &F) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("FixBooleanSelectPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
- 
-     return modifiedAny;
-@@ -5964,9 +5924,7 @@ bool GenXGatherCoalescing::runOnBasicBlock(llvm::BasicBlock &bb) {
- }
- 
- bool GenXGatherCoalescing::runOnFunction(llvm::Function &F) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("GenXGatherCoalescing::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -6113,9 +6071,7 @@ bool PromoteToPrivateMemoryPass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool PromoteToPrivateMemoryPass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("PromoteToPrivateMemoryPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -6181,9 +6137,7 @@ bool ReplaceLLVMIntrinsics::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool ReplaceLLVMIntrinsics::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("ReplaceLLVMIntrinsics::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -6278,9 +6232,7 @@ bool ReplaceUnsupportedInsts::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool ReplaceUnsupportedInsts::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("ReplaceUnsupportedInsts::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -6369,9 +6321,7 @@ bool CheckUnsupportedInsts::runOnBasicBlock(llvm::BasicBlock &bb) {
- }
- 
- bool CheckUnsupportedInsts::runOnFunction(llvm::Function &F) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("CheckUnsupportedInsts::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -6440,9 +6390,7 @@ bool MangleOpenCLBuiltins::runOnBasicBlock(llvm::BasicBlock &bb) {
- }
- 
- bool MangleOpenCLBuiltins::runOnFunction(llvm::Function &F) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("MangleOpenCLBuiltins::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -6828,9 +6776,7 @@ bool FixAddressSpace::runOnFunction(llvm::Function &F) {
-     // Transformations are correct when the function is not internal.
-     // This is due to address space calculation algorithm.
-     // TODO: problems can be met in case of Stack Calls
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("FixAddressSpace::runOnFunction", F.getName());
--#endif
-     if (F.getLinkage() == llvm::GlobalValue::LinkageTypes::InternalLinkage)
-         return false;
- 
-@@ -6854,9 +6800,7 @@ class DemotePHIs : public llvm::FunctionPass {
- char DemotePHIs::ID = 0;
- 
- bool DemotePHIs::runOnFunction(llvm::Function &F) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("DemotePHIs::runOnFunction", F.getName());
--#endif
-     if (F.isDeclaration() || skipFunction(F))
-         return false;
-     std::vector<llvm::Instruction *> WorkList;
-diff --git a/src/type.cpp b/src/type.cpp
-index 688a4e874..fa0cb04db 100644
---- a/src/type.cpp
-+++ b/src/type.cpp
-@@ -1822,14 +1822,10 @@ llvm::DIType *StructType::GetDIType(llvm::DIScope *scope) const {
-     llvm::DIFile *diFile = pos.GetDIFile();
-     llvm::DINamespace *diSpace = pos.GetDINamespace();
-     return m->diBuilder->createStructType(diSpace, GetString(), diFile,
--                                          pos.first_line,          // Line number
--                                          layout->getSizeInBits(), // Size in bits
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--                                          layout->getAlignment() * 8, // Alignment in bits
--#else                                                                 // LLVM 10.0+
-+                                          pos.first_line,                     // Line number
-+                                          layout->getSizeInBits(),            // Size in bits
-                                           layout->getAlignment().value() * 8, // Alignment in bits
--#endif
--                                          llvm::DINode::FlagZero, // Flags
-+                                          llvm::DINode::FlagZero,             // Flags
-                                           NULL, elements);
- }
- 
-diff --git a/tests/lit-tests/1771.ispc b/tests/lit-tests/1771.ispc
-index 98064d84d..4feb73dd7 100644
---- a/tests/lit-tests/1771.ispc
-+++ b/tests/lit-tests/1771.ispc
-@@ -5,7 +5,6 @@
- // RUN: %{ispc} %s --target=sse4-i16x8 --emit-asm -o - | FileCheck %s -check-prefix=CHECKSSE4_I16X8
- // RUN: %{ispc} %s --target=sse4-i8x16 --emit-asm -o - | FileCheck %s -check-prefix=CHECKSSE4_I8X16
- 
--// REQUIRES: LLVM_10_0+
- // REQUIRES: X86_ENABLED
- 
- // CHECKAVX2_I32X8: {{[a-z]*xor[a-z]*}}  %xmm0, %xmm0, %xmm0
-diff --git a/tests/lit-tests/1844.ispc b/tests/lit-tests/1844.ispc
-index 793a8866c..189edf4c3 100644
---- a/tests/lit-tests/1844.ispc
-+++ b/tests/lit-tests/1844.ispc
-@@ -6,9 +6,6 @@
- 
- // REQUIRES: X86_ENABLED
- 
--// It doesn't work for anything earlier than 10.0, but it will not be fixed, so don't run.
--// REQUIRES: LLVM_10_0+
--
- extern uniform unsigned int64 var_6;
- extern uniform unsigned int16 var_11;
- extern uniform bool arr_201 [1] [15] [20];
-diff --git a/tests/lit-tests/1926.ispc b/tests/lit-tests/1926.ispc
-index 70f7cc3c2..7921c91a6 100644
---- a/tests/lit-tests/1926.ispc
-+++ b/tests/lit-tests/1926.ispc
-@@ -2,8 +2,6 @@
- // RUN: cat %T/1926.o.json \
- // RUN:   | FileCheck %s
- 
--// REQUIRES: LLVM_10_0+
--
- // CHECK: "traceEvents"
- // CHECK: "detail"
- export uniform int foo(uniform int a[], uniform int count) {
-diff --git a/tests/lit-tests/cpus_x86.ispc b/tests/lit-tests/cpus_x86.ispc
-index 516efdd4c..4d60186f6 100644
---- a/tests/lit-tests/cpus_x86.ispc
-+++ b/tests/lit-tests/cpus_x86.ispc
-@@ -24,6 +24,8 @@
- //; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=icl
- //; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=icelake-server
- //; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=icx
-+//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=tigerlake
-+//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=tgl
- 
- // REQUIRES: X86_ENABLED
- 
-diff --git a/tests/lit-tests/cpus_x86_llvm10.ispc b/tests/lit-tests/cpus_x86_llvm10.ispc
-deleted file mode 100644
-index ef00000e5..000000000
---- a/tests/lit-tests/cpus_x86_llvm10.ispc
-+++ /dev/null
-@@ -1,11 +0,0 @@
--// The test checks that cpu definitions (including all synonyms) are successfully consumed by compiler.
--
--//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=tigerlake
--//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=tgl
--
--// REQUIRES: X86_ENABLED
--// REQUIRES: LLVM_10_0+
--
--uniform int i;
--
--void foo() {}
-diff --git a/tests/lit-tests/lit.cfg b/tests/lit-tests/lit.cfg
-index 17016579d..045e69437 100644
---- a/tests/lit-tests/lit.cfg
-+++ b/tests/lit-tests/lit.cfg
-@@ -30,11 +30,6 @@ print("Config:")
- 
- # LLVM version
- llvm_version = LooseVersion(ispc_llvm_version_number)
--if llvm_version >= LooseVersion("10.0.0"):
--    print("LLVM_10_0+: YES")
--    config.available_features.add("LLVM_10_0+")
--else:
--    print("LLVM_10_0+: NO")
- 
- if llvm_version >= LooseVersion("12.0.0"):
-     print("LLVM_12_0+: YES")
diff --git a/srcpkgs/ispc/patches/llvm12-003.patch b/srcpkgs/ispc/patches/llvm12-003.patch
deleted file mode 100644
index 0423afc9e3f9..000000000000
--- a/srcpkgs/ispc/patches/llvm12-003.patch
+++ /dev/null
@@ -1,1504 +0,0 @@
-From 1851d18b213dbad169937076176b2d5509733c76 Mon Sep 17 00:00:00 2001
-From: Deepak Rajendrakumaran <deepak.rajendrakumaran@intel.com>
-Date: Tue, 12 Jan 2021 22:15:12 -0800
-Subject: [PATCH] fixes #1821 - Removing LLVMGetName() and switching to
- LLVM::Twine.
-
----
- src/ctx.cpp      | 304 ++++++++++++++++++++++-------------------------
- src/ctx.h        |  72 +++++------
- src/expr.cpp     |  36 +++---
- src/llvmutil.cpp |  17 ---
- src/llvmutil.h   |   5 -
- src/opt.cpp      | 103 +++++++++-------
- 6 files changed, 255 insertions(+), 282 deletions(-)
-
-diff --git a/src/ctx.cpp b/src/ctx.cpp
-index 42c4ea09d..ded524b71 100644
---- a/src/ctx.cpp
-+++ b/src/ctx.cpp
-@@ -1020,8 +1020,8 @@ void FunctionEmitContext::EmitCaseLabel(int value, bool checkMask, SourcePos pos
-     llvm::BasicBlock *bbCaseImpl = NULL;
-     if (emitGenXHardwareMask()) {
-         // Create basic block with actual case implementation
--        std::string bbName = bbCase->getName().str() + "_impl";
--        bbCaseImpl = CreateBasicBlock(bbName.c_str(), bbCase);
-+        llvm::Twine bbName = llvm::Twine(bbCase->getName()) + "_impl";
-+        bbCaseImpl = CreateBasicBlock(bbName, bbCase);
-     }
- #endif
- 
-@@ -1185,7 +1185,7 @@ bool FunctionEmitContext::initLabelBBlocks(ASTNode *node, void *data) {
-     if (ctx->labelMap.find(ls->name) != ctx->labelMap.end())
-         Error(ls->pos, "Multiple labels named \"%s\" in function.", ls->name.c_str());
-     else {
--        llvm::BasicBlock *bb = ctx->CreateBasicBlock(ls->name.c_str());
-+        llvm::BasicBlock *bb = ctx->CreateBasicBlock(ls->name);
-         ctx->labelMap[ls->name] = bb;
-     }
-     return true;
-@@ -1299,7 +1299,7 @@ llvm::Value *FunctionEmitContext::Any(llvm::Value *mask) {
-     // We can actually call either one, since both are i32s as far as
-     // LLVM's type system is concerned...
-     llvm::Function *fmm = mm[0]->function;
--    return CallInst(fmm, NULL, mask, LLVMGetName(mask, "_any"));
-+    return CallInst(fmm, NULL, mask, llvm::Twine(mask->getName()) + "_any");
- }
- 
- llvm::Value *FunctionEmitContext::All(llvm::Value *mask) {
-@@ -1315,7 +1315,7 @@ llvm::Value *FunctionEmitContext::All(llvm::Value *mask) {
-     // We can actually call either one, since both are i32s as far as
-     // LLVM's type system is concerned...
-     llvm::Function *fmm = mm[0]->function;
--    return CallInst(fmm, NULL, mask, LLVMGetName(mask, "_all"));
-+    return CallInst(fmm, NULL, mask, llvm::Twine(mask->getName()) + "_all");
- }
- 
- llvm::Value *FunctionEmitContext::None(llvm::Value *mask) {
-@@ -1331,7 +1331,7 @@ llvm::Value *FunctionEmitContext::None(llvm::Value *mask) {
-     // We can actually call either one, since both are i32s as far as
-     // LLVM's type system is concerned...
-     llvm::Function *fmm = mm[0]->function;
--    return CallInst(fmm, NULL, mask, LLVMGetName(mask, "_none"));
-+    return CallInst(fmm, NULL, mask, llvm::Twine(mask->getName()) + "_none");
- }
- 
- llvm::Value *FunctionEmitContext::LaneMask(llvm::Value *v) {
-@@ -1349,7 +1349,7 @@ llvm::Value *FunctionEmitContext::LaneMask(llvm::Value *v) {
-     // We can actually call either one, since both are i32s as far as
-     // LLVM's type system is concerned...
-     llvm::Function *fmm = mm[0]->function;
--    return CallInst(fmm, NULL, v, LLVMGetName(v, "_movmsk"));
-+    return CallInst(fmm, NULL, v, llvm::Twine(v->getName()) + "_movmsk");
- }
- 
- llvm::Value *FunctionEmitContext::MasksAllEqual(llvm::Value *v1, llvm::Value *v2) {
-@@ -1364,11 +1364,12 @@ llvm::Value *FunctionEmitContext::MasksAllEqual(llvm::Value *v1, llvm::Value *v2
- #else
-     if (g->target->getArch() == Arch::wasm32) {
-         llvm::Function *fmm = m->module->getFunction("__wasm_cmp_msk_eq");
--        return CallInst(fmm, NULL, {v1, v2}, LLVMGetName("wasm_cmp_msk_eq", v1, v2));
-+        return CallInst(fmm, NULL, {v1, v2}, ((llvm::Twine("wasm_cmp_msk_eq_") + v1->getName()) + "_") + v2->getName());
-     }
-     llvm::Value *mm1 = LaneMask(v1);
-     llvm::Value *mm2 = LaneMask(v2);
--    return CmpInst(llvm::Instruction::ICmp, llvm::CmpInst::ICMP_EQ, mm1, mm2, LLVMGetName("equal", v1, v2));
-+    return CmpInst(llvm::Instruction::ICmp, llvm::CmpInst::ICMP_EQ, mm1, mm2,
-+                   ((llvm::Twine("equal_") + v1->getName()) + "_") + v2->getName());
- #endif
- }
- 
-@@ -1392,7 +1393,7 @@ llvm::Value *FunctionEmitContext::GetStringPtr(const std::string &str) {
-     return new llvm::BitCastInst(lstrPtr, LLVMTypes::VoidPointerType, "str_void_ptr", bblock);
- }
- 
--llvm::BasicBlock *FunctionEmitContext::CreateBasicBlock(const char *name, llvm::BasicBlock *insertAfter) {
-+llvm::BasicBlock *FunctionEmitContext::CreateBasicBlock(const llvm::Twine &name, llvm::BasicBlock *insertAfter) {
-     llvm::BasicBlock *newBB = llvm::BasicBlock::Create(*g->ctx, name, llvmFunction);
-     if (insertAfter)
-         newBB->moveAfter(insertAfter);
-@@ -1416,14 +1417,15 @@ llvm::Value *FunctionEmitContext::I1VecToBoolVec(llvm::Value *b) {
- 
-         for (unsigned int i = 0; i < at->getNumElements(); ++i) {
-             llvm::Value *elt = ExtractInst(b, i);
--            llvm::Value *sext = SwitchBoolSize(elt, LLVMTypes::BoolVectorStorageType, LLVMGetName(elt, "_to_boolvec"));
-+            llvm::Value *sext =
-+                SwitchBoolSize(elt, LLVMTypes::BoolVectorStorageType, llvm::Twine(elt->getName()) + "_to_boolvec");
-             ret = InsertInst(ret, sext, i);
-         }
-         return ret;
-     } else {
-         // For non-array types, convert to 'LLVMTypes::BoolVectorType' if
-         // necessary.
--        return SwitchBoolSize(b, LLVMTypes::BoolVectorType, LLVMGetName(b, "_to_boolvec"));
-+        return SwitchBoolSize(b, LLVMTypes::BoolVectorType, llvm::Twine(b->getName()) + "_to_boolvec");
-     }
- }
- 
-@@ -1563,7 +1565,7 @@ static int lArrayVectorWidth(llvm::Type *t) {
- }
- 
- llvm::Value *FunctionEmitContext::BinaryOperator(llvm::Instruction::BinaryOps inst, llvm::Value *v0, llvm::Value *v1,
--                                                 const char *name) {
-+                                                 const llvm::Twine &name) {
-     if (v0 == NULL || v1 == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -1573,7 +1575,7 @@ llvm::Value *FunctionEmitContext::BinaryOperator(llvm::Instruction::BinaryOps in
-     llvm::Type *type = v0->getType();
-     int arraySize = lArrayVectorWidth(type);
-     if (arraySize == 0) {
--        llvm::Instruction *bop = llvm::BinaryOperator::Create(inst, v0, v1, name ? name : "", bblock);
-+        llvm::Instruction *bop = llvm::BinaryOperator::Create(inst, v0, v1, name, bblock);
-         AddDebugPos(bop);
-         return bop;
-     } else {
-@@ -1591,7 +1593,7 @@ llvm::Value *FunctionEmitContext::BinaryOperator(llvm::Instruction::BinaryOps in
-     }
- }
- 
--llvm::Value *FunctionEmitContext::NotOperator(llvm::Value *v, const char *name) {
-+llvm::Value *FunctionEmitContext::NotOperator(llvm::Value *v, const llvm::Twine &name) {
-     if (v == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -1603,14 +1605,14 @@ llvm::Value *FunctionEmitContext::NotOperator(llvm::Value *v, const char *name)
-     llvm::Type *type = v->getType();
-     int arraySize = lArrayVectorWidth(type);
-     if (arraySize == 0) {
--        llvm::Instruction *binst = llvm::BinaryOperator::CreateNot(v, name ? name : "not", bblock);
-+        llvm::Instruction *binst = llvm::BinaryOperator::CreateNot(v, name.isTriviallyEmpty() ? "not" : name, bblock);
-         AddDebugPos(binst);
-         return binst;
-     } else {
-         llvm::Value *ret = llvm::UndefValue::get(type);
-         for (int i = 0; i < arraySize; ++i) {
-             llvm::Value *a = ExtractInst(v, i);
--            llvm::Value *op = llvm::BinaryOperator::CreateNot(a, name ? name : "not", bblock);
-+            llvm::Value *op = llvm::BinaryOperator::CreateNot(a, name.isTriviallyEmpty() ? "not" : name, bblock);
-             AddDebugPos(op);
-             ret = InsertInst(ret, op, i);
-         }
-@@ -1638,7 +1640,7 @@ static llvm::Type *lGetMatchingBoolVectorType(llvm::Type *type) {
- }
- 
- llvm::Value *FunctionEmitContext::CmpInst(llvm::Instruction::OtherOps inst, llvm::CmpInst::Predicate pred,
--                                          llvm::Value *v0, llvm::Value *v1, const char *name) {
-+                                          llvm::Value *v0, llvm::Value *v1, const llvm::Twine &name) {
-     if (v0 == NULL || v1 == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -1648,7 +1650,8 @@ llvm::Value *FunctionEmitContext::CmpInst(llvm::Instruction::OtherOps inst, llvm
-     llvm::Type *type = v0->getType();
-     int arraySize = lArrayVectorWidth(type);
-     if (arraySize == 0) {
--        llvm::Instruction *ci = llvm::CmpInst::Create(inst, pred, v0, v1, name ? name : "cmp", bblock);
-+        llvm::Instruction *ci =
-+            llvm::CmpInst::Create(inst, pred, v0, v1, name.isTriviallyEmpty() ? "cmp" : name, bblock);
-         AddDebugPos(ci);
-         return ci;
-     } else {
-@@ -1657,14 +1660,14 @@ llvm::Value *FunctionEmitContext::CmpInst(llvm::Instruction::OtherOps inst, llvm
-         for (int i = 0; i < arraySize; ++i) {
-             llvm::Value *a = ExtractInst(v0, i);
-             llvm::Value *b = ExtractInst(v1, i);
--            llvm::Value *op = CmpInst(inst, pred, a, b, name);
-+            llvm::Value *op = CmpInst(inst, pred, a, b, name.isTriviallyEmpty() ? "cmp" : name);
-             ret = InsertInst(ret, op, i);
-         }
-         return ret;
-     }
- }
- 
--llvm::Value *FunctionEmitContext::SmearUniform(llvm::Value *value, const char *name) {
-+llvm::Value *FunctionEmitContext::SmearUniform(llvm::Value *value, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -1704,21 +1707,19 @@ llvm::Value *FunctionEmitContext::SmearUniform(llvm::Value *value, const char *n
-     return ret;
- }
- 
--llvm::Value *FunctionEmitContext::BitCastInst(llvm::Value *value, llvm::Type *type, const char *name) {
-+llvm::Value *FunctionEmitContext::BitCastInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_bitcast");
--
--    llvm::Instruction *inst = new llvm::BitCastInst(value, type, name, bblock);
-+    llvm::Instruction *inst = new llvm::BitCastInst(
-+        value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_bitcast" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Value *FunctionEmitContext::PtrToIntInst(llvm::Value *value, const char *name) {
-+llvm::Value *FunctionEmitContext::PtrToIntInst(llvm::Value *value, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -1728,23 +1729,19 @@ llvm::Value *FunctionEmitContext::PtrToIntInst(llvm::Value *value, const char *n
-         // no-op for varying pointers; they're already vectors of ints
-         return value;
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_ptr2int");
-     llvm::Type *type = LLVMTypes::PointerIntType;
--    llvm::Instruction *inst = new llvm::PtrToIntInst(value, type, name, bblock);
-+    llvm::Instruction *inst = new llvm::PtrToIntInst(
-+        value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_ptr2int" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Value *FunctionEmitContext::PtrToIntInst(llvm::Value *value, llvm::Type *toType, const char *name) {
-+llvm::Value *FunctionEmitContext::PtrToIntInst(llvm::Value *value, llvm::Type *toType, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_ptr2int");
--
-     llvm::Type *fromType = value->getType();
-     if (llvm::isa<llvm::VectorType>(fromType)) {
-         // varying pointer
-@@ -1752,27 +1749,26 @@ llvm::Value *FunctionEmitContext::PtrToIntInst(llvm::Value *value, llvm::Type *t
-             // already the right type--done
-             return value;
-         else if (fromType->getScalarSizeInBits() > toType->getScalarSizeInBits())
--            return TruncInst(value, toType, name);
-+            return TruncInst(value, toType,
-+                             name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_ptr2int" : name);
-         else {
-             AssertPos(currentPos, fromType->getScalarSizeInBits() < toType->getScalarSizeInBits());
--            return ZExtInst(value, toType, name);
-+            return ZExtInst(value, toType, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_ptr2int" : name);
-         }
-     }
- 
--    llvm::Instruction *inst = new llvm::PtrToIntInst(value, toType, name, bblock);
-+    llvm::Instruction *inst = new llvm::PtrToIntInst(
-+        value, toType, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_ptr2int" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Value *FunctionEmitContext::IntToPtrInst(llvm::Value *value, llvm::Type *toType, const char *name) {
-+llvm::Value *FunctionEmitContext::IntToPtrInst(llvm::Value *value, llvm::Type *toType, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_int2ptr");
--
-     llvm::Type *fromType = value->getType();
-     if (llvm::isa<llvm::VectorType>(fromType)) {
-         // varying pointer
-@@ -1780,95 +1776,87 @@ llvm::Value *FunctionEmitContext::IntToPtrInst(llvm::Value *value, llvm::Type *t
-             // done
-             return value;
-         else if (fromType->getScalarSizeInBits() > toType->getScalarSizeInBits())
--            return TruncInst(value, toType, name);
-+            return TruncInst(value, toType,
-+                             name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_int2ptr" : name);
-         else {
-             AssertPos(currentPos, fromType->getScalarSizeInBits() < toType->getScalarSizeInBits());
--            return ZExtInst(value, toType, name);
-+            return ZExtInst(value, toType, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_int2ptr" : name);
-         }
-     }
- 
--    llvm::Instruction *inst = new llvm::IntToPtrInst(value, toType, name, bblock);
-+    llvm::Instruction *inst = new llvm::IntToPtrInst(
-+        value, toType, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_int2ptr" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Instruction *FunctionEmitContext::TruncInst(llvm::Value *value, llvm::Type *type, const char *name) {
-+llvm::Instruction *FunctionEmitContext::TruncInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_trunc");
--
-     // TODO: we should probably handle the array case as in
-     // e.g. BitCastInst(), but we don't currently need that functionality
--    llvm::Instruction *inst = new llvm::TruncInst(value, type, name, bblock);
-+    llvm::Instruction *inst = new llvm::TruncInst(
-+        value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_trunc" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
- llvm::Instruction *FunctionEmitContext::CastInst(llvm::Instruction::CastOps op, llvm::Value *value, llvm::Type *type,
--                                                 const char *name) {
-+                                                 const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_cast");
--
-     // TODO: we should probably handle the array case as in
-     // e.g. BitCastInst(), but we don't currently need that functionality
--    llvm::Instruction *inst = llvm::CastInst::Create(op, value, type, name, bblock);
-+    llvm::Instruction *inst = llvm::CastInst::Create(
-+        op, value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_cast" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Instruction *FunctionEmitContext::FPCastInst(llvm::Value *value, llvm::Type *type, const char *name) {
-+llvm::Instruction *FunctionEmitContext::FPCastInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_cast");
--
-     // TODO: we should probably handle the array case as in
-     // e.g. BitCastInst(), but we don't currently need that functionality
--    llvm::Instruction *inst = llvm::CastInst::CreateFPCast(value, type, name, bblock);
-+    llvm::Instruction *inst = llvm::CastInst::CreateFPCast(
-+        value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_cast" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Instruction *FunctionEmitContext::SExtInst(llvm::Value *value, llvm::Type *type, const char *name) {
-+llvm::Instruction *FunctionEmitContext::SExtInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_sext");
--
-     // TODO: we should probably handle the array case as in
-     // e.g. BitCastInst(), but we don't currently need that functionality
--    llvm::Instruction *inst = new llvm::SExtInst(value, type, name, bblock);
-+    llvm::Instruction *inst = new llvm::SExtInst(
-+        value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_sext" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Instruction *FunctionEmitContext::ZExtInst(llvm::Value *value, llvm::Type *type, const char *name) {
-+llvm::Instruction *FunctionEmitContext::ZExtInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_zext");
--
-     // TODO: we should probably handle the array case as in
-     // e.g. BitCastInst(), but we don't currently need that functionality
--    llvm::Instruction *inst = new llvm::ZExtInst(value, type, name, bblock);
-+    llvm::Instruction *inst = new llvm::ZExtInst(
-+        value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_zext" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
-@@ -1913,14 +1901,15 @@ llvm::Value *FunctionEmitContext::applyVaryingGEP(llvm::Value *basePtr, llvm::Va
-         scale = SmearUniform(scale);
-         Assert(index != NULL);
-         // offset = index * scale
--        offset = BinaryOperator(llvm::Instruction::Mul, scale, index, LLVMGetName("mul", scale, index));
-+        offset = BinaryOperator(llvm::Instruction::Mul, scale, index,
-+                                ((llvm::Twine("mul_") + scale->getName()) + "_") + index->getName());
-     }
- 
-     // For 64-bit targets, if we've been doing our offset calculations in
-     // 32 bits, we still have to convert to a 64-bit value before we
-     // actually add the offset to the pointer.
-     if (g->target->is32Bit() == false && g->opt.force32BitAddressing == true)
--        offset = SExtInst(offset, LLVMTypes::Int64VectorType, LLVMGetName(offset, "_to_64"));
-+        offset = SExtInst(offset, LLVMTypes::Int64VectorType, llvm::Twine(offset->getName()) + "_to_64");
- 
-     // Smear out the pointer to be varying; either the base pointer or the
-     // index must be varying for this method to be called.
-@@ -1929,7 +1918,7 @@ llvm::Value *FunctionEmitContext::applyVaryingGEP(llvm::Value *basePtr, llvm::Va
-     llvm::Value *varyingPtr = baseIsUniform ? SmearUniform(basePtr) : basePtr;
- 
-     // newPtr = ptr + offset
--    return BinaryOperator(llvm::Instruction::Add, varyingPtr, offset, LLVMGetName(basePtr, "_offset"));
-+    return BinaryOperator(llvm::Instruction::Add, varyingPtr, offset, llvm::Twine(basePtr->getName()) + "_offset");
- }
- 
- void FunctionEmitContext::MatchIntegerTypes(llvm::Value **v0, llvm::Value **v1) {
-@@ -2006,13 +1995,13 @@ llvm::Value *FunctionEmitContext::MakeSlicePointer(llvm::Value *ptr, llvm::Value
-     llvm::StructType *st = llvm::StructType::get(*g->ctx, eltTypes);
- 
-     llvm::Value *ret = llvm::UndefValue::get(st);
--    ret = InsertInst(ret, ptr, 0, LLVMGetName(ret, "_slice_ptr"));
--    ret = InsertInst(ret, offset, 1, LLVMGetName(ret, "_slice_offset"));
-+    ret = InsertInst(ret, ptr, 0, llvm::Twine(ret->getName()) + "_slice_ptr");
-+    ret = InsertInst(ret, offset, 1, llvm::Twine(ret->getName()) + "_slice_offset");
-     return ret;
- }
- 
- llvm::Value *FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::Value *index, const Type *ptrRefType,
--                                                    const char *name) {
-+                                                    const llvm::Twine &name) {
-     if (basePtr == NULL || index == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -2065,8 +2054,8 @@ llvm::Value *FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::
-         // uniform, so just emit the regular LLVM GEP instruction
-         llvm::Value *ind[1] = {index};
-         llvm::ArrayRef<llvm::Value *> arrayRef(&ind[0], &ind[1]);
--        llvm::Instruction *inst =
--            llvm::GetElementPtrInst::Create(PTYPE(basePtr), basePtr, arrayRef, name ? name : "gep", bblock);
-+        llvm::Instruction *inst = llvm::GetElementPtrInst::Create(PTYPE(basePtr), basePtr, arrayRef,
-+                                                                  name.isTriviallyEmpty() ? "gep" : name, bblock);
-         AddDebugPos(inst);
-         return inst;
-     } else
-@@ -2074,7 +2063,7 @@ llvm::Value *FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::
- }
- 
- llvm::Value *FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::Value *index0, llvm::Value *index1,
--                                                    const Type *ptrRefType, const char *name) {
-+                                                    const Type *ptrRefType, const llvm::Twine &name) {
-     if (basePtr == NULL || index0 == NULL || index1 == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -2114,8 +2103,8 @@ llvm::Value *FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::
-         // uniform, so just emit the regular LLVM GEP instruction
-         llvm::Value *indices[2] = {index0, index1};
-         llvm::ArrayRef<llvm::Value *> arrayRef(&indices[0], &indices[2]);
--        llvm::Instruction *inst =
--            llvm::GetElementPtrInst::Create(PTYPE(basePtr), basePtr, arrayRef, name ? name : "gep", bblock);
-+        llvm::Instruction *inst = llvm::GetElementPtrInst::Create(PTYPE(basePtr), basePtr, arrayRef,
-+                                                                  name.isTriviallyEmpty() ? "gep" : name, bblock);
-         AddDebugPos(inst);
-         return inst;
-     } else {
-@@ -2138,7 +2127,7 @@ llvm::Value *FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::
- }
- 
- llvm::Value *FunctionEmitContext::AddElementOffset(llvm::Value *fullBasePtr, int elementNum, const Type *ptrRefType,
--                                                   const char *name, const PointerType **resultPtrType) {
-+                                                   const llvm::Twine &name, const PointerType **resultPtrType) {
-     if (resultPtrType != NULL)
-         AssertPos(currentPos, ptrRefType != NULL);
- 
-@@ -2195,8 +2184,8 @@ llvm::Value *FunctionEmitContext::AddElementOffset(llvm::Value *fullBasePtr, int
-         // If the pointer is uniform, we can use the regular LLVM GEP.
-         llvm::Value *offsets[2] = {LLVMInt32(0), LLVMInt32(elementNum)};
-         llvm::ArrayRef<llvm::Value *> arrayRef(&offsets[0], &offsets[2]);
--        resultPtr =
--            llvm::GetElementPtrInst::Create(PTYPE(basePtr), basePtr, arrayRef, name ? name : "struct_offset", bblock);
-+        resultPtr = llvm::GetElementPtrInst::Create(PTYPE(basePtr), basePtr, arrayRef,
-+                                                    name.isTriviallyEmpty() ? "struct_offset" : name, bblock);
-     } else {
-         // Otherwise do the math to find the offset and add it to the given
-         // varying pointers
-@@ -2237,7 +2226,7 @@ llvm::Value *FunctionEmitContext::AddElementOffset(llvm::Value *fullBasePtr, int
-         return resultPtr;
- }
- 
--llvm::Value *FunctionEmitContext::SwitchBoolSize(llvm::Value *value, llvm::Type *toType, const char *name) {
-+llvm::Value *FunctionEmitContext::SwitchBoolSize(llvm::Value *value, llvm::Type *toType, const llvm::Twine &name) {
-     if ((value == NULL) || (toType == NULL)) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -2248,20 +2237,18 @@ llvm::Value *FunctionEmitContext::SwitchBoolSize(llvm::Value *value, llvm::Type
-     llvm::Value *newBool = value;
-     if (g->target->getDataLayout()->getTypeSizeInBits(fromType) >
-         g->target->getDataLayout()->getTypeSizeInBits(toType)) {
--        if (name == NULL)
--            name = LLVMGetName(value, "_switchBool");
--        newBool = TruncInst(value, toType, name);
-+        newBool =
-+            TruncInst(value, toType, name.isTriviallyEmpty() ? (llvm::Twine(value->getName()) + "_switchBool") : name);
-     } else if (g->target->getDataLayout()->getTypeSizeInBits(fromType) <
-                g->target->getDataLayout()->getTypeSizeInBits(toType)) {
--        if (name == NULL)
--            name = LLVMGetName(value, "_switchBool");
--        newBool = SExtInst(value, toType, name);
-+        newBool =
-+            SExtInst(value, toType, name.isTriviallyEmpty() ? (llvm::Twine(value->getName()) + "_switchBool") : name);
-     }
- 
-     return newBool;
- }
- 
--llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, const Type *type, const char *name) {
-+llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, const Type *type, const llvm::Twine &name) {
-     if (ptr == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -2270,13 +2257,13 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, const Type *type, c
-     llvm::PointerType *pt = llvm::dyn_cast<llvm::PointerType>(ptr->getType());
-     AssertPos(currentPos, pt != NULL);
- 
--    if (name == NULL)
--        name = LLVMGetName(ptr, "_load");
--
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
--    llvm::LoadInst *inst = new llvm::LoadInst(pt->getPointerElementType(), ptr, name, bblock);
-+    llvm::LoadInst *inst =
-+        new llvm::LoadInst(pt->getPointerElementType(), ptr,
-+                           name.isTriviallyEmpty() ? (llvm::Twine(ptr->getName()) + "_load") : name, bblock);
- #else
--    llvm::LoadInst *inst = new llvm::LoadInst(ptr, name, bblock);
-+    llvm::LoadInst *inst =
-+        new llvm::LoadInst(ptr, name.isTriviallyEmpty() ? (llvm::Twine(ptr->getName()) + "_load") : name, bblock);
- #endif
- 
-     if (g->opt.forceAlignedMemory && llvm::dyn_cast<llvm::VectorType>(pt->getElementType())) {
-@@ -2307,8 +2294,8 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, const Type *type, c
- static llvm::Value *lFinalSliceOffset(FunctionEmitContext *ctx, llvm::Value *ptr, const PointerType **ptrType) {
-     Assert(CastType<PointerType>(*ptrType) != NULL);
- 
--    llvm::Value *slicePtr = ctx->ExtractInst(ptr, 0, LLVMGetName(ptr, "_ptr"));
--    llvm::Value *sliceOffset = ctx->ExtractInst(ptr, 1, LLVMGetName(ptr, "_offset"));
-+    llvm::Value *slicePtr = ctx->ExtractInst(ptr, 0, llvm::Twine(ptr->getName()) + "_ptr");
-+    llvm::Value *sliceOffset = ctx->ExtractInst(ptr, 1, llvm::Twine(ptr->getName()) + "_offset");
- 
-     // slicePtr should be a pointer to an soa-width wide array of the
-     // final atomic/enum/pointer type
-@@ -2327,14 +2314,14 @@ static llvm::Value *lFinalSliceOffset(FunctionEmitContext *ctx, llvm::Value *ptr
-         slicePtr = ctx->BitCastInst(slicePtr, (*ptrType)->LLVMType(g->ctx));
- 
-     // And finally index based on the slice offset
--    return ctx->GetElementPtrInst(slicePtr, sliceOffset, *ptrType, LLVMGetName(slicePtr, "_final_gep"));
-+    return ctx->GetElementPtrInst(slicePtr, sliceOffset, *ptrType, llvm::Twine(slicePtr->getName()) + "_final_gep");
- }
- 
- /** Utility routine that loads from a uniform pointer to soa<> data,
-     returning a regular uniform (non-SOA result).
-  */
- llvm::Value *FunctionEmitContext::loadUniformFromSOA(llvm::Value *ptr, llvm::Value *mask, const PointerType *ptrType,
--                                                     const char *name) {
-+                                                     const llvm::Twine &name) {
-     const Type *unifType = ptrType->GetBaseType()->GetAsUniformType();
- 
-     const CollectionType *ct = CastType<CollectionType>(ptrType->GetBaseType());
-@@ -2363,7 +2350,7 @@ llvm::Value *FunctionEmitContext::loadUniformFromSOA(llvm::Value *ptr, llvm::Val
- }
- 
- llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask, const Type *ptrRefType,
--                                           const char *name, bool one_elem) {
-+                                           const llvm::Twine &name, bool one_elem) {
-     if (ptr == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -2371,9 +2358,6 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
- 
-     AssertPos(currentPos, ptrRefType != NULL && mask != NULL);
- 
--    if (name == NULL)
--        name = LLVMGetName(ptr, "_load");
--
-     const PointerType *ptrType;
-     const Type *elType;
-     if (CastType<ReferenceType>(ptrRefType) != NULL) {
-@@ -2393,7 +2377,8 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
- 
-     if (ptrType->IsUniformType()) {
-         if (ptrType->IsSlice()) {
--            return loadUniformFromSOA(ptr, mask, ptrType, name);
-+            return loadUniformFromSOA(ptr, mask, ptrType,
-+                                      name.isTriviallyEmpty() ? (llvm::Twine(ptr->getName()) + "_load") : name);
-         } else {
-             // FIXME: same issue as above load inst regarding alignment...
-             //
-@@ -2405,11 +2390,15 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
-             const AtomicType *atomicType = CastType<AtomicType>(ptrType->GetBaseType());
- 
- #if ISPC_LLVM_VERSION <= ISPC_LLVM_10_0
--            llvm::LoadInst *inst = new llvm::LoadInst(ptr, name, false /* not volatile */, bblock);
-+            llvm::LoadInst *inst =
-+                new llvm::LoadInst(ptr, name.isTriviallyEmpty() ? (llvm::Twine(ptr->getName()) + "_load") : name,
-+                                   false /* not volatile */, bblock);
- #else // LLVM 11.0+
-             llvm::PointerType *ptr_type = llvm::dyn_cast<llvm::PointerType>(ptr->getType());
-             llvm::LoadInst *inst =
--                new llvm::LoadInst(ptr_type->getPointerElementType(), ptr, name, false /* not volatile */, bblock);
-+                new llvm::LoadInst(ptr_type->getPointerElementType(), ptr,
-+                                   name.isTriviallyEmpty() ? (llvm::Twine(ptr->getName()) + "_load") : name,
-+                                   false /* not volatile */, bblock);
- #endif
- 
-             if (atomicType != NULL && atomicType->IsVaryingType()) {
-@@ -2433,7 +2422,8 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
-     } else {
-         // Otherwise we should have a varying ptr and it's time for a
-         // gather.
--        llvm::Value *gather_result = gather(ptr, ptrType, GetFullMask(), name);
-+        llvm::Value *gather_result = gather(ptr, ptrType, GetFullMask(),
-+                                            name.isTriviallyEmpty() ? (llvm::Twine(ptr->getName()) + "_load") : name);
-         if (!one_elem)
-             return gather_result;
- 
-@@ -2453,19 +2443,19 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
-         // We can actually call either one, since both are i32s as far as
-         // LLVM's type system is concerned...
-         llvm::Function *fmm = mm[0]->function;
--        llvm::Value *int_mask = CallInst(fmm, NULL, mask, LLVMGetName(mask, "_movmsk"));
-+        llvm::Value *int_mask = CallInst(fmm, NULL, mask, llvm::Twine(mask->getName()) + "_movmsk");
-         std::vector<Symbol *> lz;
-         m->symbolTable->LookupFunction("__count_trailing_zeros_i64", &lz);
-         llvm::Function *flz = lz[0]->function;
--        llvm::Value *elem_idx = CallInst(flz, NULL, int_mask, LLVMGetName(mask, "_clz"));
--        llvm::Value *elem = llvm::ExtractElementInst::Create(gather_result, elem_idx,
--                                                             LLVMGetName(gather_result, "_umasked_elem"), bblock);
-+        llvm::Value *elem_idx = CallInst(flz, NULL, int_mask, llvm::Twine(mask->getName()) + "_clz");
-+        llvm::Value *elem = llvm::ExtractElementInst::Create(
-+            gather_result, elem_idx, llvm::Twine(gather_result->getName()) + "_umasked_elem", bblock);
-         return elem;
-     }
- }
- 
- llvm::Value *FunctionEmitContext::gather(llvm::Value *ptr, const PointerType *ptrType, llvm::Value *mask,
--                                         const char *name) {
-+                                         const llvm::Twine &name) {
-     // We should have a varying pointer if we get here...
-     AssertPos(currentPos, ptrType->IsVaryingType());
- 
-@@ -2602,7 +2592,8 @@ void FunctionEmitContext::addGSMetadata(llvm::Value *v, SourcePos pos) {
-     inst->setMetadata("last_column", md);
- }
- 
--llvm::Value *FunctionEmitContext::AllocaInst(llvm::Type *llvmType, const char *name, int align, bool atEntryBlock) {
-+llvm::Value *FunctionEmitContext::AllocaInst(llvm::Type *llvmType, const llvm::Twine &name, int align,
-+                                             bool atEntryBlock) {
-     if (llvmType == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -2615,12 +2606,12 @@ llvm::Value *FunctionEmitContext::AllocaInst(llvm::Type *llvmType, const char *n
-         llvm::Instruction *retInst = allocaBlock->getTerminator();
-         AssertPos(currentPos, retInst);
-         unsigned AS = llvmFunction->getParent()->getDataLayout().getAllocaAddrSpace();
--        inst = new llvm::AllocaInst(llvmType, AS, name ? name : "", retInst);
-+        inst = new llvm::AllocaInst(llvmType, AS, name, retInst);
-     } else {
-         // Unless the caller overrode the default and wants it in the
-         // current basic block
-         unsigned AS = llvmFunction->getParent()->getDataLayout().getAllocaAddrSpace();
--        inst = new llvm::AllocaInst(llvmType, AS, name ? name : "", bblock);
-+        inst = new llvm::AllocaInst(llvmType, AS, name, bblock);
-     }
- 
-     // If no alignment was specified but we have an array of a uniform
-@@ -2639,7 +2630,8 @@ llvm::Value *FunctionEmitContext::AllocaInst(llvm::Type *llvmType, const char *n
-     return inst;
- }
- 
--llvm::Value *FunctionEmitContext::AllocaInst(const Type *ptrType, const char *name, int align, bool atEntryBlock) {
-+llvm::Value *FunctionEmitContext::AllocaInst(const Type *ptrType, const llvm::Twine &name, int align,
-+                                             bool atEntryBlock) {
-     if (ptrType == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -3075,66 +3067,59 @@ llvm::Instruction *FunctionEmitContext::BranchInst(llvm::BasicBlock *trueBlock,
-     return b;
- }
- 
--llvm::Value *FunctionEmitContext::ExtractInst(llvm::Value *v, int elt, const char *name) {
-+llvm::Value *FunctionEmitContext::ExtractInst(llvm::Value *v, int elt, const llvm::Twine &name) {
-     if (v == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL) {
--        char buf[32];
--        snprintf(buf, sizeof(buf), "_extract_%d", elt);
--        name = LLVMGetName(v, buf);
--    }
-     llvm::Instruction *ei = NULL;
-     if (llvm::isa<llvm::VectorType>(v->getType()))
--        ei = llvm::ExtractElementInst::Create(v, LLVMInt32(elt), name, bblock);
-+        ei = llvm::ExtractElementInst::Create(
-+            v, LLVMInt32(elt),
-+            name.isTriviallyEmpty() ? ((llvm::Twine(v->getName()) + "_extract_") + llvm::Twine(elt)) : name, bblock);
-     else
--        ei = llvm::ExtractValueInst::Create(v, elt, name, bblock);
-+        ei = llvm::ExtractValueInst::Create(
-+            v, elt, name.isTriviallyEmpty() ? ((llvm::Twine(v->getName()) + "_extract_") + llvm::Twine(elt)) : name,
-+            bblock);
-     AddDebugPos(ei);
-     return ei;
- }
- 
--llvm::Value *FunctionEmitContext::InsertInst(llvm::Value *v, llvm::Value *eltVal, int elt, const char *name) {
-+llvm::Value *FunctionEmitContext::InsertInst(llvm::Value *v, llvm::Value *eltVal, int elt, const llvm::Twine &name) {
-     if (v == NULL || eltVal == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL) {
--        char buf[32];
--        snprintf(buf, sizeof(buf), "_insert_%d", elt);
--        name = LLVMGetName(v, buf);
--    }
--
-     llvm::Instruction *ii = NULL;
-     if (llvm::isa<llvm::VectorType>(v->getType()))
--        ii = llvm::InsertElementInst::Create(v, eltVal, LLVMInt32(elt), name, bblock);
-+        ii = llvm::InsertElementInst::Create(
-+            v, eltVal, LLVMInt32(elt),
-+            name.isTriviallyEmpty() ? ((llvm::Twine(v->getName()) + "_insert_") + llvm::Twine(elt)) : name, bblock);
-     else
--        ii = llvm::InsertValueInst::Create(v, eltVal, elt, name, bblock);
-+        ii = llvm::InsertValueInst::Create(
-+            v, eltVal, elt,
-+            name.isTriviallyEmpty() ? ((llvm::Twine(v->getName()) + "_insert_") + llvm::Twine(elt)) : name, bblock);
-     AddDebugPos(ii);
-     return ii;
- }
- 
--llvm::Value *FunctionEmitContext::ShuffleInst(llvm::Value *v1, llvm::Value *v2, llvm::Value *mask, const char *name) {
-+llvm::Value *FunctionEmitContext::ShuffleInst(llvm::Value *v1, llvm::Value *v2, llvm::Value *mask,
-+                                              const llvm::Twine &name) {
-     if (v1 == NULL || v2 == NULL || mask == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL) {
--        char buf[32];
--        snprintf(buf, sizeof(buf), "_shuffle");
--        name = LLVMGetName(v1, buf);
--    }
--
--    llvm::Instruction *ii = new llvm::ShuffleVectorInst(v1, v2, mask, name, bblock);
-+    llvm::Instruction *ii = new llvm::ShuffleVectorInst(
-+        v1, v2, mask, name.isTriviallyEmpty() ? (llvm::Twine(v1->getName()) + "_shuffle") : name, bblock);
- 
-     AddDebugPos(ii);
-     return ii;
- }
- 
--llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vecType, const char *name) {
-+llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vecType, const llvm::Twine &name) {
-     if (v == NULL || vecType == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -3148,12 +3133,6 @@ llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vec
-     Assert(ty && ty->getVectorElementType() == v->getType());
- #endif
- 
--    if (name == NULL) {
--        char buf[32];
--        snprintf(buf, sizeof(buf), "_broadcast");
--        name = LLVMGetName(v, buf);
--    }
--
-     // Generate the following sequence:
-     //   %name_init.i = insertelement <4 x i32> undef, i32 %val, i32 0
-     //   %name.i = shufflevector <4 x i32> %name_init.i, <4 x i32> undef,
-@@ -3163,7 +3142,7 @@ llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vec
-     llvm::Value *undef2 = llvm::UndefValue::get(vecType);
- 
-     // InsertElement
--    llvm::Twine tw = llvm::Twine(name) + llvm::Twine("_init");
-+    llvm::Twine tw = name.isTriviallyEmpty() ? (llvm::Twine(v->getName()) + "_broadcast") : name + llvm::Twine("_init");
-     llvm::Value *insert = InsertInst(undef1, v, 0, tw.str().c_str());
- 
-     // ShuffleVector
-@@ -3179,28 +3158,27 @@ llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vec
-         llvm::ConstantVector::getSplat(llvm::ElementCount::get(static_cast<unsigned int>(ty->getNumElements()), false),
-                                        llvm::Constant::getNullValue(llvm::Type::getInt32Ty(*g->ctx)));
- #endif
--    llvm::Value *ret = ShuffleInst(insert, undef2, zeroVec, name);
-+    llvm::Value *ret = ShuffleInst(insert, undef2, zeroVec,
-+                                   name.isTriviallyEmpty() ? (llvm::Twine(v->getName()) + "_broadcast") : name);
- 
-     return ret;
- }
- 
--llvm::PHINode *FunctionEmitContext::PhiNode(llvm::Type *type, int count, const char *name) {
--    llvm::PHINode *pn = llvm::PHINode::Create(type, count, name ? name : "phi", bblock);
-+llvm::PHINode *FunctionEmitContext::PhiNode(llvm::Type *type, int count, const llvm::Twine &name) {
-+    llvm::PHINode *pn = llvm::PHINode::Create(type, count, name.isTriviallyEmpty() ? "phi" : name, bblock);
-     AddDebugPos(pn);
-     return pn;
- }
- 
- llvm::Instruction *FunctionEmitContext::SelectInst(llvm::Value *test, llvm::Value *val0, llvm::Value *val1,
--                                                   const char *name) {
-+                                                   const llvm::Twine &name) {
-     if (test == NULL || val0 == NULL || val1 == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(test, "_select");
--
--    llvm::Instruction *inst = llvm::SelectInst::Create(test, val0, val1, name, bblock);
-+    llvm::Instruction *inst = llvm::SelectInst::Create(
-+        test, val0, val1, name.isTriviallyEmpty() ? (llvm::Twine(test->getName()) + "_select") : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
-@@ -3226,7 +3204,7 @@ static unsigned int lCalleeArgCount(llvm::Value *callee, const FunctionType *fun
- }
- 
- llvm::Value *FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType *funcType,
--                                           const std::vector<llvm::Value *> &args, const char *name) {
-+                                           const std::vector<llvm::Value *> &args, const llvm::Twine &name) {
-     if (func == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -3258,9 +3236,9 @@ llvm::Value *FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-         llvm::PointerType *func_ptr_type = llvm::dyn_cast<llvm::PointerType>(func->getType());
-         llvm::FunctionType *func_type = llvm::dyn_cast<llvm::FunctionType>(func_ptr_type->getPointerElementType());
--        llvm::CallInst *callinst = llvm::CallInst::Create(func_type, func, argVals, name ? name : "", bblock);
-+        llvm::CallInst *callinst = llvm::CallInst::Create(func_type, func, argVals, name, bblock);
- #else
--        llvm::CallInst *callinst = llvm::CallInst::Create(func, argVals, name ? name : "", bblock);
-+        llvm::CallInst *callinst = llvm::CallInst::Create(func, argVals, name, bblock);
- #endif
- 
-         // We could be dealing with a function pointer in which case this will not be a 'llvm::Function'.
-@@ -3464,14 +3442,14 @@ llvm::Value *FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType
- }
- 
- llvm::Value *FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType *funcType, llvm::Value *arg,
--                                           const char *name) {
-+                                           const llvm::Twine &name) {
-     std::vector<llvm::Value *> args;
-     args.push_back(arg);
-     return CallInst(func, funcType, args, name);
- }
- 
- llvm::Value *FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType *funcType, llvm::Value *arg0,
--                                           llvm::Value *arg1, const char *name) {
-+                                           llvm::Value *arg1, const llvm::Twine &name) {
-     std::vector<llvm::Value *> args;
-     args.push_back(arg0);
-     args.push_back(arg1);
-diff --git a/src/ctx.h b/src/ctx.h
-index 6e5ad74ba..48b3bb826 100644
---- a/src/ctx.h
-+++ b/src/ctx.h
-@@ -302,7 +302,7 @@ class FunctionEmitContext {
-     llvm::Value *GetStringPtr(const std::string &str);
- 
-     /** Create a new basic block with given name */
--    llvm::BasicBlock *CreateBasicBlock(const char *name, llvm::BasicBlock *insertAfter = NULL);
-+    llvm::BasicBlock *CreateBasicBlock(const llvm::Twine &name, llvm::BasicBlock *insertAfter = NULL);
- 
-     /** Given a vector with element type i1, return a vector of type
-         LLVMTypes::BoolVectorType.  This method handles the conversion for
-@@ -380,33 +380,33 @@ class FunctionEmitContext {
-         this also handles applying the given operation to the vector
-         elements. */
-     llvm::Value *BinaryOperator(llvm::Instruction::BinaryOps inst, llvm::Value *v0, llvm::Value *v1,
--                                const char *name = NULL);
-+                                const llvm::Twine &name = "");
- 
-     /** Emit the "not" operator.  Like BinaryOperator(), this also handles
-         a VectorType-based operand. */
--    llvm::Value *NotOperator(llvm::Value *v, const char *name = NULL);
-+    llvm::Value *NotOperator(llvm::Value *v, const llvm::Twine &name = "");
- 
-     /** Emit a comparison instruction.  If the operands are VectorTypes,
-         then a value for the corresponding boolean VectorType is
-         returned. */
-     llvm::Value *CmpInst(llvm::Instruction::OtherOps inst, llvm::CmpInst::Predicate pred, llvm::Value *v0,
--                         llvm::Value *v1, const char *name = NULL);
-+                         llvm::Value *v1, const llvm::Twine &name = "");
- 
-     /** Given a scalar value, return a vector of the same type (or an
-         array, for pointer types). */
--    llvm::Value *SmearUniform(llvm::Value *value, const char *name = NULL);
-+    llvm::Value *SmearUniform(llvm::Value *value, const llvm::Twine &name = "");
- 
--    llvm::Value *BitCastInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
--    llvm::Value *PtrToIntInst(llvm::Value *value, const char *name = NULL);
--    llvm::Value *PtrToIntInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
--    llvm::Value *IntToPtrInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
-+    llvm::Value *BitCastInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
-+    llvm::Value *PtrToIntInst(llvm::Value *value, const llvm::Twine &name = "");
-+    llvm::Value *PtrToIntInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
-+    llvm::Value *IntToPtrInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
- 
--    llvm::Instruction *TruncInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
-+    llvm::Instruction *TruncInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
-     llvm::Instruction *CastInst(llvm::Instruction::CastOps op, llvm::Value *value, llvm::Type *type,
--                                const char *name = NULL);
--    llvm::Instruction *FPCastInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
--    llvm::Instruction *SExtInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
--    llvm::Instruction *ZExtInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
-+                                const llvm::Twine &name = "");
-+    llvm::Instruction *FPCastInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
-+    llvm::Instruction *SExtInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
-+    llvm::Instruction *ZExtInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
- 
-     /** Given two integer-typed values (but possibly one vector and the
-         other not, and or of possibly-different bit-widths), update their
-@@ -426,9 +426,9 @@ class FunctionEmitContext {
-         pointers.  The underlying type of the base pointer must be provided
-         via the ptrType parameter */
-     llvm::Value *GetElementPtrInst(llvm::Value *basePtr, llvm::Value *index, const Type *ptrType,
--                                   const char *name = NULL);
-+                                   const llvm::Twine &name = "");
-     llvm::Value *GetElementPtrInst(llvm::Value *basePtr, llvm::Value *index0, llvm::Value *index1, const Type *ptrType,
--                                   const char *name = NULL);
-+                                   const llvm::Twine &name = "");
- 
-     /** This method returns a new pointer that represents offsetting the
-         given base pointer to point at the given element number of the
-@@ -436,26 +436,26 @@ class FunctionEmitContext {
-         pointer must be a pointer to a structure type.  The ptrType gives
-         the type of the pointer, though it may be NULL if the base pointer
-         is uniform. */
--    llvm::Value *AddElementOffset(llvm::Value *basePtr, int elementNum, const Type *ptrType, const char *name = NULL,
--                                  const PointerType **resultPtrType = NULL);
-+    llvm::Value *AddElementOffset(llvm::Value *basePtr, int elementNum, const Type *ptrType,
-+                                  const llvm::Twine &name = "", const PointerType **resultPtrType = NULL);
- 
-     /** Bool is stored as i8 and <WIDTH x i8> but represented in IR as i1 and
-      * <WIDTH x MASK>. This is a helper function to match bool size at storage
-      * interface. */
--    llvm::Value *SwitchBoolSize(llvm::Value *value, llvm::Type *toType, const char *name = NULL);
-+    llvm::Value *SwitchBoolSize(llvm::Value *value, llvm::Type *toType, const llvm::Twine &name = "");
-     /** Load from the memory location(s) given by lvalue, using the given
-         mask.  The lvalue may be varying, in which case this corresponds to
-         a gather from the multiple memory locations given by the array of
-         pointer values given by the lvalue.  If the lvalue is not varying,
-         then both the mask pointer and the type pointer may be NULL. */
--    llvm::Value *LoadInst(llvm::Value *ptr, llvm::Value *mask, const Type *ptrType, const char *name = NULL,
-+    llvm::Value *LoadInst(llvm::Value *ptr, llvm::Value *mask, const Type *ptrType, const llvm::Twine &name = "",
-                           bool one_elem = false);
- 
-     /* Load from memory location(s) given.
-      * 'type' needs to be provided when storage type is different from IR type. For example,
-      * 'unform bool' is 'i1' in IR but stored as 'i8'.
-      * Otherwise leave this as NULL. */
--    llvm::Value *LoadInst(llvm::Value *ptr, const Type *type = NULL, const char *name = NULL);
-+    llvm::Value *LoadInst(llvm::Value *ptr, const Type *type = NULL, const llvm::Twine &name = "");
- 
-     /** Emits an alloca instruction to allocate stack storage for the given
-         type.  If a non-zero alignment is specified, the object is also
-@@ -463,7 +463,8 @@ class FunctionEmitContext {
-         instruction is added at the start of the function in the entry
-         basic block; if it should be added to the current basic block, then
-         the atEntryBlock parameter should be false. */
--    llvm::Value *AllocaInst(llvm::Type *llvmType, const char *name = NULL, int align = 0, bool atEntryBlock = true);
-+    llvm::Value *AllocaInst(llvm::Type *llvmType, const llvm::Twine &name = "", int align = 0,
-+                            bool atEntryBlock = true);
- 
-     /** Emits an alloca instruction to allocate stack storage for the given
-         type.  If a non-zero alignment is specified, the object is also
-@@ -474,7 +475,7 @@ class FunctionEmitContext {
-         This implementation is preferred when possible. It is needed when
-         storage type is different from IR type. For example,
-         'unform bool' is 'i1' in IR but stored as 'i8'. */
--    llvm::Value *AllocaInst(const Type *ptrType, const char *name = NULL, int align = 0, bool atEntryBlock = true);
-+    llvm::Value *AllocaInst(const Type *ptrType, const llvm::Twine &name = "", int align = 0, bool atEntryBlock = true);
- 
-     /** Standard store instruction; for this variant, the lvalue must be a
-         single pointer, not a varying lvalue.
-@@ -502,39 +503,41 @@ class FunctionEmitContext {
-     /** This convenience method maps to an llvm::ExtractElementInst if the
-         given value is a llvm::VectorType, and to an llvm::ExtractValueInst
-         otherwise. */
--    llvm::Value *ExtractInst(llvm::Value *v, int elt, const char *name = NULL);
-+    llvm::Value *ExtractInst(llvm::Value *v, int elt, const llvm::Twine &name = "");
- 
-     /** This convenience method maps to an llvm::InsertElementInst if the
-         given value is a llvm::VectorType, and to an llvm::InsertValueInst
-         otherwise. */
--    llvm::Value *InsertInst(llvm::Value *v, llvm::Value *eltVal, int elt, const char *name = NULL);
-+    llvm::Value *InsertInst(llvm::Value *v, llvm::Value *eltVal, int elt, const llvm::Twine &name = "");
- 
-     /** This convenience method maps to an llvm::ShuffleVectorInst. */
--    llvm::Value *ShuffleInst(llvm::Value *v1, llvm::Value *v2, llvm::Value *mask, const char *name = NULL);
-+    llvm::Value *ShuffleInst(llvm::Value *v1, llvm::Value *v2, llvm::Value *mask, const llvm::Twine &name = "");
- 
-     /** This convenience method to generate broadcast pattern. It takes a value
-         and a vector type. Type of the value must match element type of the
-         vector. */
--    llvm::Value *BroadcastValue(llvm::Value *v, llvm::Type *vecType, const char *name = NULL);
-+    llvm::Value *BroadcastValue(llvm::Value *v, llvm::Type *vecType, const llvm::Twine &name = "");
- 
--    llvm::PHINode *PhiNode(llvm::Type *type, int count, const char *name = NULL);
--    llvm::Instruction *SelectInst(llvm::Value *test, llvm::Value *val0, llvm::Value *val1, const char *name = NULL);
-+    llvm::PHINode *PhiNode(llvm::Type *type, int count, const llvm::Twine &name = "");
-+    llvm::Instruction *SelectInst(llvm::Value *test, llvm::Value *val0, llvm::Value *val1,
-+                                  const llvm::Twine &name = "");
- 
-     /** Emits IR to do a function call with the given arguments.  If the
-         function type is a varying function pointer type, its full type
-         must be provided in funcType.  funcType can be NULL if func is a
-         uniform function pointer. */
-     llvm::Value *CallInst(llvm::Value *func, const FunctionType *funcType, const std::vector<llvm::Value *> &args,
--                          const char *name = NULL);
-+                          const llvm::Twine &name = "");
- 
-     /** This is a convenience method that issues a call instruction to a
-         function that takes just a single argument. */
--    llvm::Value *CallInst(llvm::Value *func, const FunctionType *funcType, llvm::Value *arg, const char *name = NULL);
-+    llvm::Value *CallInst(llvm::Value *func, const FunctionType *funcType, llvm::Value *arg,
-+                          const llvm::Twine &name = "");
- 
-     /** This is a convenience method that issues a call instruction to a
-         function that takes two arguments. */
-     llvm::Value *CallInst(llvm::Value *func, const FunctionType *funcType, llvm::Value *arg0, llvm::Value *arg1,
--                          const char *name = NULL);
-+                          const llvm::Twine &name = "");
- 
-     /** Launch an asynchronous task to run the given function, passing it
-         he given argument values. */
-@@ -756,9 +759,10 @@ class FunctionEmitContext {
-     void maskedStore(llvm::Value *value, llvm::Value *ptr, const Type *ptrType, llvm::Value *mask);
-     void storeUniformToSOA(llvm::Value *value, llvm::Value *ptr, llvm::Value *mask, const Type *valueType,
-                            const PointerType *ptrType);
--    llvm::Value *loadUniformFromSOA(llvm::Value *ptr, llvm::Value *mask, const PointerType *ptrType, const char *name);
-+    llvm::Value *loadUniformFromSOA(llvm::Value *ptr, llvm::Value *mask, const PointerType *ptrType,
-+                                    const llvm::Twine &name = "");
- 
--    llvm::Value *gather(llvm::Value *ptr, const PointerType *ptrType, llvm::Value *mask, const char *name);
-+    llvm::Value *gather(llvm::Value *ptr, const PointerType *ptrType, llvm::Value *mask, const llvm::Twine &name = "");
- 
-     llvm::Value *addVaryingOffsetsIfNeeded(llvm::Value *ptr, const Type *ptrType);
- };
-diff --git a/src/expr.cpp b/src/expr.cpp
-index 80cc3020a..6d38d1889 100644
---- a/src/expr.cpp
-+++ b/src/expr.cpp
-@@ -1021,11 +1021,11 @@ static llvm::Value *lEmitNegate(Expr *arg, SourcePos pos, FunctionEmitContext *c
-     ctx->SetDebugPos(pos);
-     if (type->IsFloatType()) {
-         llvm::Value *zero = llvm::ConstantFP::getZeroValueForNegation(type->LLVMType(g->ctx));
--        return ctx->BinaryOperator(llvm::Instruction::FSub, zero, argVal, LLVMGetName(argVal, "_negate"));
-+        return ctx->BinaryOperator(llvm::Instruction::FSub, zero, argVal, llvm::Twine(argVal->getName()) + "_negate");
-     } else {
-         llvm::Value *zero = lLLVMConstantValue(type, g->ctx, 0.);
-         AssertPos(pos, type->IsIntType());
--        return ctx->BinaryOperator(llvm::Instruction::Sub, zero, argVal, LLVMGetName(argVal, "_negate"));
-+        return ctx->BinaryOperator(llvm::Instruction::Sub, zero, argVal, llvm::Twine(argVal->getName()) + "_negate");
-     }
- }
- 
-@@ -1047,11 +1047,11 @@ llvm::Value *UnaryExpr::GetValue(FunctionEmitContext *ctx) const {
-         return lEmitNegate(expr, pos, ctx);
-     case LogicalNot: {
-         llvm::Value *argVal = expr->GetValue(ctx);
--        return ctx->NotOperator(argVal, LLVMGetName(argVal, "_logicalnot"));
-+        return ctx->NotOperator(argVal, llvm::Twine(argVal->getName()) + "_logicalnot");
-     }
-     case BitNot: {
-         llvm::Value *argVal = expr->GetValue(ctx);
--        return ctx->NotOperator(argVal, LLVMGetName(argVal, "_bitnot"));
-+        return ctx->NotOperator(argVal, llvm::Twine(argVal->getName()) + "_bitnot");
-     }
-     default:
-         FATAL("logic error");
-@@ -1518,7 +1518,8 @@ static llvm::Value *lEmitBinaryArith(BinaryExpr::Op op, llvm::Value *value0, llv
-             return NULL;
-         }
- 
--        return ctx->BinaryOperator(inst, value0, value1, LLVMGetName(opName, value0, value1));
-+        return ctx->BinaryOperator(inst, value0, value1,
-+                                   (((llvm::Twine(opName) + "_") + value0->getName()) + "_") + value1->getName());
-     }
- }
- 
-@@ -1563,7 +1564,7 @@ static llvm::Value *lEmitBinaryCmp(BinaryExpr::Op op, llvm::Value *e0Val, llvm::
-     }
- 
-     llvm::Value *cmp = ctx->CmpInst(isFloatOp ? llvm::Instruction::FCmp : llvm::Instruction::ICmp, pred, e0Val, e1Val,
--                                    LLVMGetName(opName, e0Val, e1Val));
-+                                    (((llvm::Twine(opName) + "_") + e0Val->getName()) + "_") + e1Val->getName());
-     // This is a little ugly: CmpInst returns i1 values, but we use vectors
-     // of i32s for varying bool values; type convert the result here if
-     // needed.
-@@ -4177,7 +4178,7 @@ static llvm::Value *lConvertToSlicePointer(FunctionEmitContext *ctx, llvm::Value
-     // offsets
-     llvm::Value *result = llvm::Constant::getNullValue(sliceStructType);
-     // And replace the pointer in the struct with the given pointer
--    return ctx->InsertInst(result, ptr, 0, LLVMGetName(ptr, "_slice"));
-+    return ctx->InsertInst(result, ptr, 0, llvm::Twine(ptr->getName()) + "_slice");
- }
- 
- /** If the given array index is a compile time constant, check to see if it
-@@ -4258,8 +4259,8 @@ llvm::Value *IndexExpr::GetLValue(FunctionEmitContext *ctx) const {
-         // Convert to a slice pointer if we're indexing into SOA data
-         basePtrValue = lConvertPtrToSliceIfNeeded(ctx, basePtrValue, &baseExprType);
- 
--        llvm::Value *ptr =
--            ctx->GetElementPtrInst(basePtrValue, indexValue, baseExprType, LLVMGetName(basePtrValue, "_offset"));
-+        llvm::Value *ptr = ctx->GetElementPtrInst(basePtrValue, indexValue, baseExprType,
-+                                                  llvm::Twine(basePtrValue->getName()) + "_offset");
-         return lAddVaryingOffsetsIfNeeded(ctx, ptr, GetLValueType());
-     }
- 
-@@ -4290,8 +4291,8 @@ llvm::Value *IndexExpr::GetLValue(FunctionEmitContext *ctx) const {
-     ctx->SetDebugPos(pos);
- 
-     // And do the actual indexing calculation..
--    llvm::Value *ptr =
--        ctx->GetElementPtrInst(basePtr, LLVMInt32(0), indexValue, basePtrType, LLVMGetName(basePtr, "_offset"));
-+    llvm::Value *ptr = ctx->GetElementPtrInst(basePtr, LLVMInt32(0), indexValue, basePtrType,
-+                                              llvm::Twine(basePtr->getName()) + "_offset");
-     return lAddVaryingOffsetsIfNeeded(ctx, ptr, GetLValueType());
- }
- 
-@@ -4788,15 +4789,14 @@ llvm::Value *VectorMemberExpr::GetValue(FunctionEmitContext *ctx) const {
-         for (size_t i = 0; i < identifier.size(); ++i) {
-             char idStr[2] = {identifier[i], '\0'};
-             llvm::Value *elementPtr =
--                ctx->AddElementOffset(basePtr, indices[i], basePtrType, LLVMGetName(basePtr, idStr));
-+                ctx->AddElementOffset(basePtr, indices[i], basePtrType, llvm::Twine(basePtr->getName()) + idStr);
-             llvm::Value *elementValue = ctx->LoadInst(elementPtr, elementMask, elementPtrType);
- 
--            const char *resultName = LLVMGetName(resultPtr, idStr);
--            llvm::Value *ptmp = ctx->AddElementOffset(resultPtr, i, NULL, resultName);
-+            llvm::Value *ptmp = ctx->AddElementOffset(resultPtr, i, NULL, llvm::Twine(resultPtr->getName()) + idStr);
-             ctx->StoreInst(elementValue, ptmp, elementPtrType, expr->GetType()->IsUniformType());
-         }
- 
--        return ctx->LoadInst(resultPtr, memberType, LLVMGetName(basePtr, "_swizzle"));
-+        return ctx->LoadInst(resultPtr, memberType, llvm::Twine(basePtr->getName()) + "_swizzle");
-     }
- }
- 
-@@ -4932,7 +4932,7 @@ llvm::Value *MemberExpr::GetValue(FunctionEmitContext *ctx) const {
- 
-     ctx->SetDebugPos(pos);
-     std::string suffix = std::string("_") + identifier;
--    return ctx->LoadInst(lvalue, mask, lvalueType, LLVMGetName(lvalue, suffix.c_str()));
-+    return ctx->LoadInst(lvalue, mask, lvalueType, llvm::Twine(lvalue->getName()) + suffix);
- }
- 
- const Type *MemberExpr::GetType() const { return NULL; }
-@@ -6502,7 +6502,7 @@ static llvm::Value *lTypeConvAtomic(FunctionEmitContext *ctx, llvm::Value *exprV
-                 // does for everyone else...
-                 Assert(cast);
-                 cast = ctx->SwitchBoolSize(cast, LLVMTypes::BoolVectorType->getElementType(),
--                                           LLVMGetName(cast, "to_i_bool"));
-+                                           llvm::Twine(cast->getName()) + "to_i_bool");
-             }
-         } else {
-             // fromType->IsVaryingType())
-@@ -8246,7 +8246,7 @@ llvm::Value *NewExpr::GetValue(FunctionEmitContext *ctx) const {
-         // pointer of the return type and to run the code for initializers,
-         // if present.
-         llvm::Type *ptrType = retType->LLVMType(g->ctx);
--        ptrValue = ctx->BitCastInst(ptrValue, ptrType, LLVMGetName(ptrValue, "_cast_ptr"));
-+        ptrValue = ctx->BitCastInst(ptrValue, ptrType, llvm::Twine(ptrValue->getName()) + "_cast_ptr");
- 
-         if (initExpr != NULL)
-             InitSymbol(ptrValue, allocType, initExpr, ctx, pos);
-diff --git a/src/llvmutil.cpp b/src/llvmutil.cpp
-index 970175dbf..d0becb9f5 100644
---- a/src/llvmutil.cpp
-+++ b/src/llvmutil.cpp
-@@ -1605,23 +1605,6 @@ llvm::Value *LLVMShuffleVectors(llvm::Value *v1, llvm::Value *v2, int32_t shuf[]
-     return new llvm::ShuffleVectorInst(v1, v2, vec, "shuffle", insertBefore);
- }
- 
--const char *LLVMGetName(llvm::Value *v, const char *s) {
--    if (v == NULL)
--        return s;
--    std::string ret = std::string(v->getName());
--    ret += s;
--    return strdup(ret.c_str());
--}
--
--const char *LLVMGetName(const char *op, llvm::Value *v1, llvm::Value *v2) {
--    std::string r = op;
--    r += "_";
--    r += v1->getName().str();
--    r += "_";
--    r += v2->getName().str();
--    return strdup(r.c_str());
--}
--
- #ifdef ISPC_GENX_ENABLED
- bool lIsSVMLoad(llvm::Instruction *inst) {
-     Assert(inst);
-diff --git a/src/llvmutil.h b/src/llvmutil.h
-index 42cce4d83..07d089bb4 100644
---- a/src/llvmutil.h
-+++ b/src/llvmutil.h
-@@ -328,11 +328,6 @@ extern llvm::Value *LLVMConcatVectors(llvm::Value *v1, llvm::Value *v2, llvm::In
- extern llvm::Value *LLVMShuffleVectors(llvm::Value *v1, llvm::Value *v2, int32_t shuf[], int shufSize,
-                                        llvm::Instruction *insertBefore);
- 
--/** Utility routines to concat strings with the names of existing values to
--    create meaningful new names for instruction values.
--*/
--extern const char *LLVMGetName(llvm::Value *v, const char *);
--extern const char *LLVMGetName(const char *op, llvm::Value *v1, llvm::Value *v2);
- #ifdef ISPC_GENX_ENABLED
- enum AddressSpace { Local, Global, External };
- 
-diff --git a/src/opt.cpp b/src/opt.cpp
-index 5b1ac7b63..9d6cae058 100644
---- a/src/opt.cpp
-+++ b/src/opt.cpp
-@@ -257,7 +257,7 @@ static bool lGetSourcePosFromMetadata(const llvm::Instruction *inst, SourcePos *
-     return true;
- }
- 
--static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llvm::Value *arg1, const char *name,
-+static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llvm::Value *arg1, const llvm::Twine &name,
-                                     llvm::Instruction *insertBefore = NULL) {
-     llvm::Value *args[2] = {arg0, arg1};
-     llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[2]);
-@@ -265,21 +265,22 @@ static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llv
- }
- 
- static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llvm::Value *arg1, llvm::Value *arg2,
--                                    const char *name, llvm::Instruction *insertBefore = NULL) {
-+                                    const llvm::Twine &name, llvm::Instruction *insertBefore = NULL) {
-     llvm::Value *args[3] = {arg0, arg1, arg2};
-     llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[3]);
-     return llvm::CallInst::Create(func, newArgArray, name, insertBefore);
- }
- 
- static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llvm::Value *arg1, llvm::Value *arg2,
--                                    llvm::Value *arg3, const char *name, llvm::Instruction *insertBefore = NULL) {
-+                                    llvm::Value *arg3, const llvm::Twine &name,
-+                                    llvm::Instruction *insertBefore = NULL) {
-     llvm::Value *args[4] = {arg0, arg1, arg2, arg3};
-     llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[4]);
-     return llvm::CallInst::Create(func, newArgArray, name, insertBefore);
- }
- 
- static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llvm::Value *arg1, llvm::Value *arg2,
--                                    llvm::Value *arg3, llvm::Value *arg4, const char *name,
-+                                    llvm::Value *arg3, llvm::Value *arg4, const llvm::Twine &name,
-                                     llvm::Instruction *insertBefore = NULL) {
-     llvm::Value *args[5] = {arg0, arg1, arg2, arg3, arg4};
-     llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[5]);
-@@ -287,7 +288,7 @@ static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llv
- }
- 
- static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llvm::Value *arg1, llvm::Value *arg2,
--                                    llvm::Value *arg3, llvm::Value *arg4, llvm::Value *arg5, const char *name,
-+                                    llvm::Value *arg3, llvm::Value *arg4, llvm::Value *arg5, const llvm::Twine &name,
-                                     llvm::Instruction *insertBefore = NULL) {
-     llvm::Value *args[6] = {arg0, arg1, arg2, arg3, arg4, arg5};
-     llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[6]);
-@@ -991,23 +992,24 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
-                 llvm::Type *returnType = callInst->getType();
-                 Assert(llvm::isa<llvm::VectorType>(returnType));
-                 // cast the i8 * to the appropriate type
--                const char *name = LLVMGetName(callInst->getArgOperand(0), "_cast");
--                llvm::Value *castPtr = new llvm::BitCastInst(callInst->getArgOperand(0),
--                                                             llvm::PointerType::get(returnType, 0), name, callInst);
-+                llvm::Value *castPtr =
-+                    new llvm::BitCastInst(callInst->getArgOperand(0), llvm::PointerType::get(returnType, 0),
-+                                          llvm::Twine(callInst->getArgOperand(0)->getName()) + "_cast", callInst);
-                 lCopyMetadata(castPtr, callInst);
-                 int align;
-                 if (g->opt.forceAlignedMemory)
-                     align = g->target->getNativeVectorAlignment();
-                 else
-                     align = callInst->getCalledFunction() == avxMaskedLoad32 ? 4 : 8;
--                name = LLVMGetName(callInst->getArgOperand(0), "_load");
- #if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
--                llvm::Instruction *loadInst = new llvm::LoadInst(castPtr, name, false /* not volatile */,
--                                                                 llvm::MaybeAlign(align), (llvm::Instruction *)NULL);
-+                llvm::Instruction *loadInst =
-+                    new llvm::LoadInst(castPtr, llvm::Twine(callInst->getArgOperand(0)->getName()) + "_load",
-+                                       false /* not volatile */, llvm::MaybeAlign(align), (llvm::Instruction *)NULL);
- #else
-                 llvm::Instruction *loadInst = new llvm::LoadInst(
--                    llvm::dyn_cast<llvm::PointerType>(castPtr->getType())->getPointerElementType(), castPtr, name,
--                    false /* not volatile */, llvm::MaybeAlign(align).valueOrOne(), (llvm::Instruction *)NULL);
-+                    llvm::dyn_cast<llvm::PointerType>(castPtr->getType())->getPointerElementType(), castPtr,
-+                    llvm::Twine(callInst->getArgOperand(0)->getName()) + "_load", false /* not volatile */,
-+                    llvm::MaybeAlign(align).valueOrOne(), (llvm::Instruction *)NULL);
- #endif
-                 lCopyMetadata(loadInst, callInst);
-                 llvm::ReplaceInstWithInst(callInst, loadInst);
-@@ -1028,9 +1030,9 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
-                 // all lanes storing, so replace with a regular store
-                 llvm::Value *rvalue = callInst->getArgOperand(2);
-                 llvm::Type *storeType = rvalue->getType();
--                const char *name = LLVMGetName(callInst->getArgOperand(0), "_ptrcast");
--                llvm::Value *castPtr = new llvm::BitCastInst(callInst->getArgOperand(0),
--                                                             llvm::PointerType::get(storeType, 0), name, callInst);
-+                llvm::Value *castPtr =
-+                    new llvm::BitCastInst(callInst->getArgOperand(0), llvm::PointerType::get(storeType, 0),
-+                                          llvm::Twine(callInst->getArgOperand(0)->getName()) + "_ptrcast", callInst);
-                 lCopyMetadata(castPtr, callInst);
- 
-                 int align;
-@@ -1339,8 +1341,8 @@ static llvm::Value *lGetBasePointer(llvm::Value *v, llvm::Instruction *insertBef
-         if (t == NULL) {
-             return NULL;
-         } else {
--            return llvm::CastInst::Create(ci->getOpcode(), t, ci->getType()->getScalarType(), LLVMGetName(t, "_cast"),
--                                          insertBefore);
-+            return llvm::CastInst::Create(ci->getOpcode(), t, ci->getType()->getScalarType(),
-+                                          llvm::Twine(t->getName()) + "_cast", insertBefore);
-         }
-     }
- 
-@@ -1583,13 +1585,13 @@ static void lExtractConstantOffset(llvm::Value *vec, llvm::Value **constOffset,
-         if (co == NULL)
-             *constOffset = NULL;
-         else
--            *constOffset =
--                llvm::CastInst::Create(cast->getOpcode(), co, cast->getType(), LLVMGetName(co, "_cast"), insertBefore);
-+            *constOffset = llvm::CastInst::Create(cast->getOpcode(), co, cast->getType(),
-+                                                  llvm::Twine(co->getName()) + "_cast", insertBefore);
-         if (vo == NULL)
-             *variableOffset = NULL;
-         else
--            *variableOffset =
--                llvm::CastInst::Create(cast->getOpcode(), vo, cast->getType(), LLVMGetName(vo, "_cast"), insertBefore);
-+            *variableOffset = llvm::CastInst::Create(cast->getOpcode(), vo, cast->getType(),
-+                                                     llvm::Twine(vo->getName()) + "_cast", insertBefore);
-         return;
-     }
- 
-@@ -1608,16 +1610,18 @@ static void lExtractConstantOffset(llvm::Value *vec, llvm::Value **constOffset,
-             else if (c1 == NULL || llvm::isa<llvm::ConstantAggregateZero>(c1))
-                 *constOffset = c0;
-             else
--                *constOffset = llvm::BinaryOperator::Create(llvm::Instruction::Add, c0, c1, LLVMGetName("add", c0, c1),
--                                                            insertBefore);
-+                *constOffset = llvm::BinaryOperator::Create(
-+                    llvm::Instruction::Add, c0, c1, ((llvm::Twine("add_") + c0->getName()) + "_") + c1->getName(),
-+                    insertBefore);
- 
-             if (v0 == NULL || llvm::isa<llvm::ConstantAggregateZero>(v0))
-                 *variableOffset = v1;
-             else if (v1 == NULL || llvm::isa<llvm::ConstantAggregateZero>(v1))
-                 *variableOffset = v0;
-             else
--                *variableOffset = llvm::BinaryOperator::Create(llvm::Instruction::Add, v0, v1,
--                                                               LLVMGetName("add", v0, v1), insertBefore);
-+                *variableOffset = llvm::BinaryOperator::Create(
-+                    llvm::Instruction::Add, v0, v1, ((llvm::Twine("add_") + v0->getName()) + "_") + v1->getName(),
-+                    insertBefore);
-             return;
-         } else if (bop->getOpcode() == llvm::Instruction::Shl) {
-             lExtractConstantOffset(op0, &c0, &v0, insertBefore);
-@@ -1633,10 +1637,12 @@ static void lExtractConstantOffset(llvm::Value *vec, llvm::Value **constOffset,
-                 *constOffset = vec;
-                 *variableOffset = NULL;
-             } else {
--                *constOffset = llvm::BinaryOperator::Create(llvm::Instruction::Shl, c0, c1, LLVMGetName("shl", c0, c1),
--                                                            insertBefore);
--                *variableOffset = llvm::BinaryOperator::Create(llvm::Instruction::Shl, v0, c1,
--                                                               LLVMGetName("shl", v0, c1), insertBefore);
-+                *constOffset = llvm::BinaryOperator::Create(
-+                    llvm::Instruction::Shl, c0, c1, ((llvm::Twine("shl_") + c0->getName()) + "_") + c1->getName(),
-+                    insertBefore);
-+                *variableOffset = llvm::BinaryOperator::Create(
-+                    llvm::Instruction::Shl, v0, c1, ((llvm::Twine("shl_") + v0->getName()) + "_") + c1->getName(),
-+                    insertBefore);
-             }
-             return;
-         } else if (bop->getOpcode() == llvm::Instruction::Mul) {
-@@ -1648,25 +1654,30 @@ static void lExtractConstantOffset(llvm::Value *vec, llvm::Value **constOffset,
-             // Note that the first term is a constant and the last three are
-             // variable.
-             if (c0 != NULL && c1 != NULL)
--                *constOffset = llvm::BinaryOperator::Create(llvm::Instruction::Mul, c0, c1, LLVMGetName("mul", c0, c1),
--                                                            insertBefore);
-+                *constOffset = llvm::BinaryOperator::Create(
-+                    llvm::Instruction::Mul, c0, c1, ((llvm::Twine("mul_") + c0->getName()) + "_") + c1->getName(),
-+                    insertBefore);
-             else
-                 *constOffset = NULL;
- 
-             llvm::Value *va = NULL, *vb = NULL, *vc = NULL;
-             if (v0 != NULL && c1 != NULL)
--                va = llvm::BinaryOperator::Create(llvm::Instruction::Mul, v0, c1, LLVMGetName("mul", v0, c1),
-+                va = llvm::BinaryOperator::Create(llvm::Instruction::Mul, v0, c1,
-+                                                  ((llvm::Twine("mul_") + v0->getName()) + "_") + c1->getName(),
-                                                   insertBefore);
-             if (c0 != NULL && v1 != NULL)
--                vb = llvm::BinaryOperator::Create(llvm::Instruction::Mul, c0, v1, LLVMGetName("mul", c0, v1),
-+                vb = llvm::BinaryOperator::Create(llvm::Instruction::Mul, c0, v1,
-+                                                  ((llvm::Twine("mul_") + c0->getName()) + "_") + v1->getName(),
-                                                   insertBefore);
-             if (v0 != NULL && v1 != NULL)
--                vc = llvm::BinaryOperator::Create(llvm::Instruction::Mul, v0, v1, LLVMGetName("mul", v0, v1),
-+                vc = llvm::BinaryOperator::Create(llvm::Instruction::Mul, v0, v1,
-+                                                  ((llvm::Twine("mul_") + v0->getName()) + "_") + v1->getName(),
-                                                   insertBefore);
- 
-             llvm::Value *vab = NULL;
-             if (va != NULL && vb != NULL)
--                vab = llvm::BinaryOperator::Create(llvm::Instruction::Add, va, vb, LLVMGetName("add", va, vb),
-+                vab = llvm::BinaryOperator::Create(llvm::Instruction::Add, va, vb,
-+                                                   ((llvm::Twine("add_") + va->getName()) + "_") + vb->getName(),
-                                                    insertBefore);
-             else if (va != NULL)
-                 vab = va;
-@@ -1674,8 +1685,9 @@ static void lExtractConstantOffset(llvm::Value *vec, llvm::Value **constOffset,
-                 vab = vb;
- 
-             if (vab != NULL && vc != NULL)
--                *variableOffset = llvm::BinaryOperator::Create(llvm::Instruction::Add, vab, vc,
--                                                               LLVMGetName("add", vab, vc), insertBefore);
-+                *variableOffset = llvm::BinaryOperator::Create(
-+                    llvm::Instruction::Add, vab, vc, ((llvm::Twine("add_") + vab->getName()) + "_") + vc->getName(),
-+                    insertBefore);
-             else if (vab != NULL)
-                 *variableOffset = vab;
-             else
-@@ -1943,7 +1955,7 @@ static bool lOffsets32BitSafe(llvm::Value **variableOffsetPtr, llvm::Value **con
-             // all zeros (i.e. a ConstantAggregateZero, but just in case,
-             // do the more general check with lVectorIs32BitInts().
-             variableOffset = new llvm::TruncInst(variableOffset, LLVMTypes::Int32VectorType,
--                                                 LLVMGetName(variableOffset, "_trunc"), insertBefore);
-+                                                 llvm::Twine(variableOffset->getName()) + "_trunc", insertBefore);
-         else
-             return false;
-     }
-@@ -1952,7 +1964,7 @@ static bool lOffsets32BitSafe(llvm::Value **variableOffsetPtr, llvm::Value **con
-         if (lVectorIs32BitInts(constOffset)) {
-             // Truncate them so we have a 32-bit vector type for them.
-             constOffset = new llvm::TruncInst(constOffset, LLVMTypes::Int32VectorType,
--                                              LLVMGetName(constOffset, "_trunc"), insertBefore);
-+                                              llvm::Twine(constOffset->getName()) + "_trunc", insertBefore);
-         } else {
-             // FIXME: otherwise we just assume that all constant offsets
-             // can actually always fit into 32-bits...  (This could be
-@@ -1963,7 +1975,7 @@ static bool lOffsets32BitSafe(llvm::Value **variableOffsetPtr, llvm::Value **con
-             // llvm::ConstantFoldInstruction() doesn't seem to be doing
-             // enough for us in some cases if we call it from here.
-             constOffset = new llvm::TruncInst(constOffset, LLVMTypes::Int32VectorType,
--                                              LLVMGetName(constOffset, "_trunc"), insertBefore);
-+                                              llvm::Twine(constOffset->getName()) + "_trunc", insertBefore);
-         }
-     }
- 
-@@ -2012,8 +2024,8 @@ static bool lOffsets32BitSafe(llvm::Value **offsetPtr, llvm::Instruction *insert
- 
-         // Alternatively, offset could be a sequence of adds terminating
-         // in safe constant vectors or a SExt.
--        *offsetPtr =
--            new llvm::TruncInst(offset, LLVMTypes::Int32VectorType, LLVMGetName(offset, "_trunc"), insertBefore);
-+        *offsetPtr = new llvm::TruncInst(offset, LLVMTypes::Int32VectorType, llvm::Twine(offset->getName()) + "_trunc",
-+                                         insertBefore);
-         return true;
-     } else
-         return false;
-@@ -2229,7 +2241,8 @@ static bool lGSToGSBaseOffsets(llvm::CallInst *callInst) {
-     }
-     // Cast the base pointer to a void *, since that's what the
-     // __pseudo_*_base_offsets_* functions want.
--    basePtr = new llvm::IntToPtrInst(basePtr, LLVMTypes::VoidPointerType, LLVMGetName(basePtr, "_2void"), callInst);
-+    basePtr = new llvm::IntToPtrInst(basePtr, LLVMTypes::VoidPointerType, llvm::Twine(basePtr->getName()) + "_2void",
-+                                     callInst);
-     lCopyMetadata(basePtr, callInst);
-     llvm::Function *gatherScatterFunc = info->baseOffsetsFunc;
- 
-@@ -2803,7 +2816,7 @@ static bool lGSToLoadStore(llvm::CallInst *callInst) {
-                 lCopyMetadata(ptr, callInst);
-                 Debug(pos, "Transformed gather to unaligned vector load!");
-                 llvm::Instruction *newCall =
--                    lCallInst(gatherInfo->loadMaskedFunc, ptr, mask, LLVMGetName(ptr, "_masked_load"));
-+                    lCallInst(gatherInfo->loadMaskedFunc, ptr, mask, llvm::Twine(ptr->getName()) + "_masked_load");
-                 lCopyMetadata(newCall, callInst);
-                 llvm::ReplaceInstWithInst(callInst, newCall);
-                 return true;
diff --git a/srcpkgs/ispc/patches/llvm12-004.patch b/srcpkgs/ispc/patches/llvm12-004.patch
deleted file mode 100644
index 3a94d8443a5e..000000000000
--- a/srcpkgs/ispc/patches/llvm12-004.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From c03a5142444476a1caa5c2ba7fa2d92d7793d6f1 Mon Sep 17 00:00:00 2001
-From: Deepak Rajendrakumaran <deepak.rajendrakumaran@intel.com>
-Date: Mon, 25 Jan 2021 09:22:49 -0800
-Subject: [PATCH] Fixing build on llvm trunk.
-
----
- src/ctx.cpp | 7 +++----
- 1 file changed, 3 insertions(+), 4 deletions(-)
-
-diff --git a/src/ctx.cpp b/src/ctx.cpp
-index ded524b71..b60e6fe84 100644
---- a/src/ctx.cpp
-+++ b/src/ctx.cpp
-@@ -1020,8 +1020,7 @@ void FunctionEmitContext::EmitCaseLabel(int value, bool checkMask, SourcePos pos
-     llvm::BasicBlock *bbCaseImpl = NULL;
-     if (emitGenXHardwareMask()) {
-         // Create basic block with actual case implementation
--        llvm::Twine bbName = llvm::Twine(bbCase->getName()) + "_impl";
--        bbCaseImpl = CreateBasicBlock(bbName, bbCase);
-+        bbCaseImpl = CreateBasicBlock(llvm::Twine(bbCase->getName()) + "_impl", bbCase);
-     }
- #endif
- 
-@@ -3142,8 +3141,8 @@ llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vec
-     llvm::Value *undef2 = llvm::UndefValue::get(vecType);
- 
-     // InsertElement
--    llvm::Twine tw = name.isTriviallyEmpty() ? (llvm::Twine(v->getName()) + "_broadcast") : name + llvm::Twine("_init");
--    llvm::Value *insert = InsertInst(undef1, v, 0, tw.str().c_str());
-+    llvm::Value *insert =
-+        InsertInst(undef1, v, 0, name.isTriviallyEmpty() ? (llvm::Twine(v->getName()) + "_broadcast") : name + "_init");
- 
-     // ShuffleVector
- #if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
diff --git a/srcpkgs/ispc/patches/llvm12-005.patch b/srcpkgs/ispc/patches/llvm12-005.patch
deleted file mode 100644
index e3e96b00abfa..000000000000
--- a/srcpkgs/ispc/patches/llvm12-005.patch
+++ /dev/null
@@ -1,372 +0,0 @@
-From c1d0a51bf8416d42144de9e2bdd59825eaeff1ac Mon Sep 17 00:00:00 2001
-From: Arina Neshlyaeva <arina.neshlyaeva@intel.com>
-Date: Fri, 8 Jan 2021 14:13:49 -0800
-Subject: [PATCH] LLVM 11 support for gen code
-
----
- src/ctx.cpp                     |  13 ++-
- src/gen/GlobalsLocalization.cpp |   9 +-
- src/opt.cpp                     | 143 ++++++++++++++++++++++++--------
- 3 files changed, 124 insertions(+), 41 deletions(-)
-
-diff --git a/src/ctx.cpp b/src/ctx.cpp
-index b60e6fe84..2a72e6837 100644
---- a/src/ctx.cpp
-+++ b/src/ctx.cpp
-@@ -1,5 +1,5 @@
- /*
--  Copyright (c) 2010-2020, Intel Corporation
-+  Copyright (c) 2010-2021, Intel Corporation
-   All rights reserved.
- 
-   Redistribution and use in source and binary forms, with or without
-@@ -3685,8 +3685,17 @@ llvm::Value *FunctionEmitContext::GenXSimdCFPredicate(llvm::Value *value, llvm::
-     AssertPos(currentPos, llvm::isa<llvm::VectorType>(value->getType()));
-     llvm::VectorType *vt = llvm::dyn_cast<llvm::VectorType>(value->getType());
-     if (defaults == NULL) {
--        defaults = llvm::ConstantVector::getSplat(value->getType()->getVectorNumElements(),
-+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-+        defaults = llvm::ConstantVector::getSplat(vt->getVectorNumElements(),
-+                                                  llvm::Constant::getNullValue(vt->getElementType()));
-+#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+        defaults = llvm::ConstantVector::getSplat({static_cast<unsigned int>(vt->getNumElements()), false},
-                                                   llvm::Constant::getNullValue(vt->getElementType()));
-+#else
-+        defaults = llvm::ConstantVector::getSplat(
-+            llvm::ElementCount::get(static_cast<unsigned int>(vt->getNumElements()), false),
-+            llvm::Constant::getNullValue(vt->getElementType()));
-+#endif
-     }
- 
-     auto Fn = llvm::GenXIntrinsic::getGenXDeclaration(m->module, llvm::GenXIntrinsic::genx_simdcf_predicate,
-diff --git a/src/gen/GlobalsLocalization.cpp b/src/gen/GlobalsLocalization.cpp
-index a176e9462..41f3b00e2 100644
---- a/src/gen/GlobalsLocalization.cpp
-+++ b/src/gen/GlobalsLocalization.cpp
-@@ -1,5 +1,5 @@
- /*
--  Copyright (c) 2014, 2016-2020, Intel Corporation
-+  Copyright (c) 2014, 2016-2021, Intel Corporation
-   All rights reserved.
- 
-   Redistribution and use in source and binary forms, with or without
-@@ -53,8 +53,10 @@
- #include <llvm/GenXIntrinsics/GenXIntrOpts.h>
- #include <llvm/GenXIntrinsics/GenXIntrinsics.h>
- #include <llvm/GenXIntrinsics/GenXMetadata.h>
--#include <llvm/IR/CFG.h>
-+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
- #include <llvm/IR/CallSite.h>
-+#endif
-+#include <llvm/IR/CFG.h>
- #include <llvm/IR/DebugInfo.h>
- #include <llvm/IR/Dominators.h>
- #include <llvm/IR/Function.h>
-@@ -470,7 +472,8 @@ void GlobalsLocalization::LocalizeGlobals(LocalizationInfo &LI) {
-         Instruction &FirstI = *Fn->getEntryBlock().begin();
-         Type *ElemTy = GV->getType()->getElementType();
-         AllocaInst *Alloca = new AllocaInst(ElemTy, 0, GV->getName() + ".local", &FirstI);
--        Alloca->setAlignment(llvm::MaybeAlign(GV->getAlignment()));
-+        Alloca->setAlignment(llvm::MaybeAlign(GV->getAlignment()).valueOrOne());
-+
-         if (!isa<UndefValue>(GV->getInitializer()))
-             new StoreInst(GV->getInitializer(), Alloca, &FirstI);
- 
-diff --git a/src/opt.cpp b/src/opt.cpp
-index d58d77f73..1789b8476 100644
---- a/src/opt.cpp
-+++ b/src/opt.cpp
-@@ -2899,15 +2899,17 @@ static llvm::Function *lGenXMaskedInt8Inst(llvm::Instruction *inst, bool isStore
- static llvm::CallInst *lGenXStoreInst(llvm::Value *val, llvm::Value *ptr, llvm::Instruction *inst) {
-     Assert(g->target->isGenXTarget());
-     Assert(llvm::isa<llvm::VectorType>(val->getType()));
--    Assert(llvm::isPowerOf2_32(val->getType()->getVectorNumElements()));
--    Assert(val->getType()->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
-+
-+    llvm::VectorType *valVecType = llvm::dyn_cast<llvm::VectorType>(val->getType());
-+    Assert(llvm::isPowerOf2_32(valVecType->getNumElements()));
-+    Assert(valVecType->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
- 
-     // The data write of svm store must have a size that is a power of two from 16 to 128
-     // bytes. However for int8 type and simd width = 8, the data write size is 8.
-     // So we use masked store function here instead of svm store which process int8 type
-     // correctly.
--    if (val->getType()->getPrimitiveSizeInBits() / 8 < 16) {
--        Assert(val->getType()->getScalarType() == LLVMTypes::Int8Type);
-+    if (valVecType->getPrimitiveSizeInBits() / 8 < 16) {
-+        Assert(valVecType->getScalarType() == LLVMTypes::Int8Type);
-         if (llvm::Function *maskedFunc = lGenXMaskedInt8Inst(inst, true))
-             return llvm::dyn_cast<llvm::CallInst>(lCallInst(maskedFunc, ptr, val, LLVMMaskAllOn, ""));
-         else {
-@@ -2923,15 +2925,17 @@ static llvm::CallInst *lGenXStoreInst(llvm::Value *val, llvm::Value *ptr, llvm::
- 
- static llvm::CallInst *lGenXLoadInst(llvm::Value *ptr, llvm::Type *retType, llvm::Instruction *inst) {
-     Assert(llvm::isa<llvm::VectorType>(retType));
--    Assert(llvm::isPowerOf2_32(retType->getVectorNumElements()));
--    Assert(retType->getPrimitiveSizeInBits());
--    Assert(retType->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
-+
-+    llvm::VectorType *retVecType = llvm::dyn_cast<llvm::VectorType>(retType);
-+    Assert(llvm::isPowerOf2_32(retVecType->getNumElements()));
-+    Assert(retVecType->getPrimitiveSizeInBits());
-+    Assert(retVecType->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
-     // The data read of svm load must have a size that is a power of two from 16 to 128
-     // bytes. However for int8 type and simd width = 8, the data read size is 8.
-     // So we use masked load function here instead of svm load which process int8 type
-     // correctly.
--    if (retType->getPrimitiveSizeInBits() / 8 < 16) {
--        Assert(retType->getScalarType() == LLVMTypes::Int8Type);
-+    if (retVecType->getPrimitiveSizeInBits() / 8 < 16) {
-+        Assert(retVecType->getScalarType() == LLVMTypes::Int8Type);
-         if (llvm::Function *maskedFunc = lGenXMaskedInt8Inst(inst, false))
-             return llvm::dyn_cast<llvm::CallInst>(lCallInst(maskedFunc, ptr, LLVMMaskAllOn, ""));
-         else {
-@@ -5622,15 +5626,24 @@ static bool lVectorizeGEPs(llvm::Value *ptr, std::vector<PtrUse> &ptrUses, std::
-         llvm::PtrToIntInst *ptrToInt =
-             new llvm::PtrToIntInst(ptr, LLVMTypes::Int64Type, "vectorized_ptrtoint", insertBefore);
-         llvm::Instruction *addr = llvm::BinaryOperator::CreateAdd(ptrToInt, offset, "vectorized_address", insertBefore);
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+        llvm::Type *retType = llvm::FixedVectorType::get(scalar_type, reqSize / t_size);
-+#else
-         llvm::Type *retType = llvm::VectorType::get(scalar_type, reqSize / t_size);
-+#endif
-         llvm::Function *fn = llvm::GenXIntrinsic::getGenXDeclaration(
-             m->module, llvm::GenXIntrinsic::genx_svm_block_ld_unaligned, {retType, addr->getType()});
-         llvm::Instruction *ld = llvm::CallInst::Create(fn, {addr}, "vectorized_ld", insertBefore);
- 
-         if (loadingPtr) {
-             // Cast int to ptr via inttoptr
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+            ld = new llvm::IntToPtrInst(ld, llvm::FixedVectorType::get(originalType, reqSize / t_size),
-+                                        "vectorized_inttoptr", insertBefore);
-+#else
-             ld = new llvm::IntToPtrInst(ld, llvm::VectorType::get(originalType, reqSize / t_size),
-                                         "vectorized_inttoptr", insertBefore);
-+#endif
-         }
- 
-         // Scalar extracts for all loaded elements
-@@ -6160,19 +6173,34 @@ bool ReplaceLLVMIntrinsics::runOnBasicBlock(llvm::BasicBlock &bb) {
-         llvm::Instruction *inst = &*I;
-         if (llvm::CallInst *ci = llvm::dyn_cast<llvm::CallInst>(inst)) {
-             llvm::Function *func = ci->getCalledFunction();
--            if (func && func->getName() == "llvm.trap") {
-+            if (func && func->getName().equals("llvm.trap")) {
-                 llvm::Type *argTypes[] = {LLVMTypes::Int1VectorType, LLVMTypes::Int16VectorType};
-                 // Description of parameters for genx_raw_send_noresult can be found in target-genx.ll
-                 auto Fn = +llvm::GenXIntrinsic::getGenXDeclaration(
-                     m->module, llvm::GenXIntrinsic::genx_raw_send_noresult, argTypes);
-                 llvm::SmallVector<llvm::Value *, 8> Args;
-                 Args.push_back(llvm::ConstantInt::get(LLVMTypes::Int32Type, 0));
--                Args.push_back(llvm::ConstantVector::getSplat(g->target->getNativeVectorWidth(),
--                                                              llvm::ConstantInt::getTrue(*g->ctx)));
-+                Args.push_back(llvm::ConstantVector::getSplat(
-+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-+                    g->target->getNativeVectorWidth(),
-+#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+                    {static_cast<unsigned int>(g->target->getNativeVectorWidth()), false},
-+#else // LLVM 12.0+
-+                    llvm::ElementCount::get(static_cast<unsigned int>(g->target->getNativeVectorWidth()), false),
-+#endif
-+                    llvm::ConstantInt::getTrue(*g->ctx)));
-+
-                 Args.push_back(llvm::ConstantInt::get(LLVMTypes::Int32Type, 39));
-                 Args.push_back(llvm::ConstantInt::get(LLVMTypes::Int32Type, 33554448));
-                 llvm::Value *zeroMask = llvm::ConstantVector::getSplat(
--                    g->target->getNativeVectorWidth(), llvm::Constant::getNullValue(llvm::Type::getInt16Ty(*g->ctx)));
-+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-+                    g->target->getNativeVectorWidth(),
-+#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+                    {static_cast<unsigned int>(g->target->getNativeVectorWidth()), false},
-+#else // LLVM 12.0+
-+                    llvm::ElementCount::get(static_cast<unsigned int>(g->target->getNativeVectorWidth()), false),
-+#endif
-+                    llvm::Constant::getNullValue(llvm::Type::getInt16Ty(*g->ctx)));
-                 Args.push_back(zeroMask);
- 
-                 llvm::Instruction *newInst = llvm::CallInst::Create(Fn, Args, ci->getName());
-@@ -6181,7 +6209,7 @@ bool ReplaceLLVMIntrinsics::runOnBasicBlock(llvm::BasicBlock &bb) {
-                     modifiedAny = true;
-                     goto restart;
-                 }
--            } else if (func && func->getName() == "llvm.assume") {
-+            } else if (func && func->getName().equals("llvm.assume")) {
-                 ci->eraseFromParent();
-                 modifiedAny = true;
-                 goto restart;
-@@ -6335,7 +6363,7 @@ bool CheckUnsupportedInsts::runOnBasicBlock(llvm::BasicBlock &bb) {
-                 continue;
-             for (int i = 0; i < unsupportedFuncs.size(); i++) {
-                 std::smatch match;
--                std::string funcName = func->getName();
-+                std::string funcName = func->getName().str();
-                 if (std::regex_match(funcName, match, unsupportedFuncs[i])) {
-                     // We found unsupported function. Generate error and stop compilation.
-                     SourcePos pos;
-@@ -6418,12 +6446,14 @@ bool MangleOpenCLBuiltins::runOnBasicBlock(llvm::BasicBlock &bb) {
-             if (func->getName().startswith("__spirv_ocl")) {
-                 std::string mangledName;
-                 llvm::Type *retType = func->getReturnType();
--                std::string funcName = func->getName();
-+                std::string funcName = func->getName().str();
-                 std::vector<llvm::Type *> ArgTy;
-                 // spirv OpenCL builtins are used for double types only
--                Assert(retType->isVectorTy() && retType->getVectorElementType()->isDoubleTy() ||
-+                Assert(retType->isVectorTy() &&
-+                           llvm::dyn_cast<llvm::VectorType>(retType)->getElementType()->isDoubleTy() ||
-                        retType->isSingleValueType() && retType->isDoubleTy());
--                if (retType->isVectorTy() && retType->getVectorElementType()->isDoubleTy()) {
-+                if (retType->isVectorTy() &&
-+                    llvm::dyn_cast<llvm::VectorType>(retType)->getElementType()->isDoubleTy()) {
-                     ArgTy.push_back(LLVMTypes::DoubleVectorType);
-                     // _DvWIDTH suffix is used in target file to differentiate scalar
-                     // and vector versions of intrinsics. Here we remove this
-@@ -6511,8 +6541,15 @@ llvm::Value *FixAddressSpace::calculateGatherScatterAddress(llvm::Value *Ptr, ll
- 
-     // Cast offsets to int64
-     Offsets = new llvm::ZExtInst(
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+        Offsets,
-+        llvm::FixedVectorType::get(LLVMTypes::Int64Type,
-+                                   llvm::dyn_cast<llvm::VectorType>(Offsets->getType())->getNumElements()),
-+        "svm_offset_zext", InsertBefore);
-+#else
-         Offsets, llvm::VectorType::get(LLVMTypes::Int64Type, Offsets->getType()->getVectorNumElements()),
-         "svm_offset_zext", InsertBefore);
-+#endif
- 
-     if (!llvm::isa<llvm::ConstantPointerNull>(Ptr)) {
-         // Cast ptr to int64
-@@ -6520,13 +6557,31 @@ llvm::Value *FixAddressSpace::calculateGatherScatterAddress(llvm::Value *Ptr, ll
- 
-         // Vectorize ptr
-         llvm::Value *undefInsertValue =
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+            llvm::UndefValue::get(llvm::FixedVectorType::get(
-+                LLVMTypes::Int64Type, llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements()));
-+#else
-             llvm::UndefValue::get(llvm::VectorType::get(LLVMTypes::Int64Type, addressType->getVectorNumElements()));
-+#endif
-         address = llvm::InsertElementInst::Create(undefInsertValue, address, LLVMInt32(0), "svm_ptr_iei", InsertBefore);
-         llvm::Constant *zeroVec = llvm::ConstantVector::getSplat(
-+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-             addressType->getVectorNumElements(),
-+#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+            {llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements(), false},
-+#else
-+        llvm::ElementCount::get(
-+                                llvm::dyn_cast<llvm::FixedVectorType>(addressType->getNumElements(), false),
-+#endif
-             llvm::Constant::getNullValue(llvm::Type::getInt32Ty(InsertBefore->getContext())));
-+
-         llvm::Value *undefShuffleValue =
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+            llvm::UndefValue::get(llvm::FixedVectorType::get(
-+                LLVMTypes::Int64Type, llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements()));
-+#else
-             llvm::UndefValue::get(llvm::VectorType::get(LLVMTypes::Int64Type, addressType->getVectorNumElements()));
-+#endif
-         address = new llvm::ShuffleVectorInst(address, undefShuffleValue, zeroVec, "svm_ptr_svi", InsertBefore);
- 
-         // Calculate address
-@@ -6553,9 +6608,12 @@ llvm::Instruction *FixAddressSpace::processVectorLoad(llvm::LoadInst *LI) {
-     if (retType->getScalarType()->isPointerTy()) {
-         isPtrLoad = true;
-         auto scalarType = g->target->is32Bit() ? LLVMTypes::Int32Type : LLVMTypes::Int64Type;
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+        retType = llvm::FixedVectorType::get(scalarType, llvm::dyn_cast<llvm::VectorType>(retType)->getNumElements());
-+#else
-         retType = llvm::VectorType::get(scalarType, retType->getVectorNumElements());
-+#endif
-     }
--
-     llvm::Instruction *res = lGenXLoadInst(ptr, retType, llvm::dyn_cast<llvm::Instruction>(LI));
-     Assert(res);
- 
-@@ -6580,11 +6638,16 @@ llvm::Instruction *FixAddressSpace::processSVMVectorLoad(llvm::Instruction *CI)
-     ptr = new llvm::IntToPtrInst(ptr, llvm::PointerType::get(retType, 0), CI->getName() + "_inttoptr", CI);
-     llvm::Instruction *loadInst = NULL;
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
--    loadInst = new llvm::LoadInst(llvm::dyn_cast<llvm::PointerType>(ptr->getType())->getPointerElementType(), loadInst,
--                                  CI->getName(), (llvm::Instruction *)NULL);
-+    loadInst = new llvm::LoadInst(llvm::dyn_cast<llvm::PointerType>(ptr->getType())->getPointerElementType(), ptr,
-+                                  CI->getName(), false /* not volatile */,
-+                                  llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne(),
-+                                  (llvm::Instruction *)NULL);
- #else
--    loadInst = new llvm::LoadInst(ptr, CI->getName(), (llvm::Instruction *)NULL);
-+    loadInst = new llvm::LoadInst(ptr, CI->getName(), false,
-+                                  llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne(),
-+                                  (llvm::Instruction *)NULL);
- #endif
-+
-     Assert(loadInst);
-     return loadInst;
- }
-@@ -6606,7 +6669,11 @@ llvm::Instruction *FixAddressSpace::processVectorStore(llvm::StoreInst *SI) {
-     // Note: it doesn't look like a normal case for GenX target
-     if (valType->getScalarType()->isPointerTy()) {
-         auto scalarType = g->target->is32Bit() ? LLVMTypes::Int32Type : LLVMTypes::Int64Type;
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+        valType = llvm::FixedVectorType::get(scalarType, llvm::dyn_cast<llvm::VectorType>(valType)->getNumElements());
-+#else
-         valType = llvm::VectorType::get(scalarType, valType->getVectorNumElements());
-+#endif
-         val = new llvm::PtrToIntInst(val, valType, "svm_st_val_ptrtoint", SI);
-     }
- 
-@@ -6631,12 +6698,8 @@ llvm::Instruction *FixAddressSpace::processSVMVectorStore(llvm::Instruction *CI)
-     ptr = new llvm::IntToPtrInst(ptr, llvm::PointerType::get(valType, 0), CI->getName() + "_inttoptr", CI);
- 
-     llvm::Instruction *storeInst = NULL;
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
--    loadInst = new llvm::StoreInst(val, llvm::dyn_cast<llvm::PointerType>(ptr->getType())->getPointerElementType(),
--                                   storeInst, CI->getName(), (llvm::Instruction *)NULL);
--#else
--    storeInst = new llvm::StoreInst(val, ptr, (llvm::Instruction *)NULL);
--#endif
-+    storeInst = new llvm::StoreInst(val, ptr, (llvm::Instruction *)NULL,
-+                                    llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne());
-     Assert(storeInst);
-     return storeInst;
- }
-@@ -6645,15 +6708,18 @@ llvm::Instruction *FixAddressSpace::createInt8WrRegion(llvm::Value *Val, llvm::V
-     int width = g->target->getVectorWidth();
- 
-     llvm::Value *Args[8];
--
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+    Args[0] = llvm::UndefValue::get(llvm::FixedVectorType::get(LLVMTypes::Int8Type, width * 4)); // old value
-+#else
-     Args[0] = llvm::UndefValue::get(llvm::VectorType::get(LLVMTypes::Int8Type, width * 4)); // old value
--    Args[1] = Val;                                                                          // value to store
--    Args[2] = llvm::ConstantInt::get(LLVMTypes::Int32Type, 0);                              // vstride
--    Args[3] = llvm::ConstantInt::get(LLVMTypes::Int32Type, width);                          // width
--    Args[4] = llvm::ConstantInt::get(LLVMTypes::Int32Type, 4);                              // stride
--    Args[5] = llvm::ConstantInt::get(LLVMTypes::Int16Type, 0);                              // offsets
--    Args[6] = llvm::ConstantInt::get(LLVMTypes::Int32Type, 0);                              // parent width (ignored)
--    Args[7] = Mask;                                                                         // mask
-+#endif
-+    Args[1] = Val;                                                 // value to store
-+    Args[2] = llvm::ConstantInt::get(LLVMTypes::Int32Type, 0);     // vstride
-+    Args[3] = llvm::ConstantInt::get(LLVMTypes::Int32Type, width); // width
-+    Args[4] = llvm::ConstantInt::get(LLVMTypes::Int32Type, 4);     // stride
-+    Args[5] = llvm::ConstantInt::get(LLVMTypes::Int16Type, 0);     // offsets
-+    Args[6] = llvm::ConstantInt::get(LLVMTypes::Int32Type, 0);     // parent width (ignored)
-+    Args[7] = Mask;                                                // mask
- 
-     llvm::Type *Tys[4];
- 
-@@ -6708,7 +6774,12 @@ llvm::Instruction *FixAddressSpace::processGatherScatterPrivate(llvm::CallInst *
-         return NULL;
- 
-     llvm::Value *address = calculateGatherScatterAddress(ptr, offsets, CI);
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+    llvm::Type *i8VecType = llvm::FixedVectorType::get(LLVMTypes::Int8Type, width * 4);
-+#else
-     llvm::Type *i8VecType = llvm::VectorType::get(LLVMTypes::Int8Type, width * 4);
-+#endif
-+
-     bool isInt8 = (value->getType()->getScalarType() == LLVMTypes::Int8Type);
- 
-     Assert(address && "Bad gather/scatter address!");
diff --git a/srcpkgs/ispc/patches/llvm12-006.patch b/srcpkgs/ispc/patches/llvm12-006.patch
deleted file mode 100644
index a829ea48391e..000000000000
--- a/srcpkgs/ispc/patches/llvm12-006.patch
+++ /dev/null
@@ -1,126 +0,0 @@
-From bb3f493d1fbd45c79e1d9dee67a0430ba313eaad Mon Sep 17 00:00:00 2001
-From: Arina Neshlyaeva <arina.neshlyaeva@intel.com>
-Date: Tue, 19 Jan 2021 11:07:33 -0800
-Subject: [PATCH] Fixed ifdefs for LLVM_11
-
----
- src/ctx.cpp |  6 +++---
- src/opt.cpp | 18 +++++++++---------
- 2 files changed, 12 insertions(+), 12 deletions(-)
-
-diff --git a/src/ctx.cpp b/src/ctx.cpp
-index 2a72e6837..527a02f30 100644
---- a/src/ctx.cpp
-+++ b/src/ctx.cpp
-@@ -1691,7 +1691,7 @@ llvm::Value *FunctionEmitContext::SmearUniform(llvm::Value *value, const llvm::T
-     if (llvm::Constant *const_val = llvm::dyn_cast<llvm::Constant>(value)) {
- #if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-         ret = llvm::ConstantVector::getSplat(g->target->getVectorWidth(), const_val);
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
-         ret =
-             llvm::ConstantVector::getSplat({static_cast<unsigned int>(g->target->getVectorWidth()), false}, const_val);
- #else // LLVM 12.0+
-@@ -3148,7 +3148,7 @@ llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vec
- #if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-     llvm::Constant *zeroVec = llvm::ConstantVector::getSplat(
-         vecType->getVectorNumElements(), llvm::Constant::getNullValue(llvm::Type::getInt32Ty(*g->ctx)));
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
-     llvm::Constant *zeroVec =
-         llvm::ConstantVector::getSplat({static_cast<unsigned int>(ty->getNumElements()), false},
-                                        llvm::Constant::getNullValue(llvm::Type::getInt32Ty(*g->ctx)));
-@@ -3688,7 +3688,7 @@ llvm::Value *FunctionEmitContext::GenXSimdCFPredicate(llvm::Value *value, llvm::
- #if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-         defaults = llvm::ConstantVector::getSplat(vt->getVectorNumElements(),
-                                                   llvm::Constant::getNullValue(vt->getElementType()));
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
-         defaults = llvm::ConstantVector::getSplat({static_cast<unsigned int>(vt->getNumElements()), false},
-                                                   llvm::Constant::getNullValue(vt->getElementType()));
- #else
-diff --git a/src/opt.cpp b/src/opt.cpp
-index 1789b8476..3ff191a0a 100644
---- a/src/opt.cpp
-+++ b/src/opt.cpp
-@@ -1045,7 +1045,7 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
-                     align = g->target->getNativeVectorAlignment();
-                 else
-                     align = callInst->getCalledFunction() == avxMaskedLoad32 ? 4 : 8;
--#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-                 llvm::Instruction *loadInst =
-                     new llvm::LoadInst(castPtr, llvm::Twine(callInst->getArgOperand(0)->getName()) + "_load",
-                                        false /* not volatile */, llvm::MaybeAlign(align), (llvm::Instruction *)NULL);
-@@ -1472,7 +1472,7 @@ static llvm::Value *lGetBasePtrAndOffsets(llvm::Value *ptrs, llvm::Value **offse
-                     llvm::Value *zeroMask =
- #if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-                         llvm::ConstantVector::getSplat(cv->getType()->getVectorNumElements(),
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
-                         llvm::ConstantVector::getSplat(
-                             {llvm::dyn_cast<llvm::VectorType>(cv->getType())->getNumElements(), false},
- #else // LLVM 12.0+
-@@ -1495,7 +1495,7 @@ static llvm::Value *lGetBasePtrAndOffsets(llvm::Value *ptrs, llvm::Value **offse
-                         llvm::Value *zeroMask = llvm::ConstantVector::getSplat(
- #if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-                             bop_var_type->getVectorNumElements(),
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
-                             {llvm::dyn_cast<llvm::VectorType>(bop_var_type)->getNumElements(), false},
- #else // LLVM 12.0+
-                             llvm::ElementCount::get(
-@@ -2803,7 +2803,7 @@ static bool lGSToLoadStore(llvm::CallInst *callInst) {
-             llvm::Value *zeroMask =
- #if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-                 llvm::ConstantVector::getSplat(callInst->getType()->getVectorNumElements(),
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
-                 llvm::ConstantVector::getSplat(
-                     {llvm::dyn_cast<llvm::VectorType>(callInst->getType())->getNumElements(), false},
- 
-@@ -3100,7 +3100,7 @@ static bool lImproveMaskedLoad(llvm::CallInst *callInst, llvm::BasicBlock::itera
-         {
-             llvm::Type *ptrType = llvm::PointerType::get(callInst->getType(), 0);
-             ptr = new llvm::BitCastInst(ptr, ptrType, "ptr_cast_for_load", callInst);
--#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-             load = new llvm::LoadInst(
-                 ptr, callInst->getName(), false /* not volatile */,
-                 llvm::MaybeAlign(g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align)
-@@ -3459,7 +3459,7 @@ llvm::Value *lGEPAndLoad(llvm::Value *basePtr, int64_t offset, int align, llvm::
-                          llvm::Type *type) {
-     llvm::Value *ptr = lGEPInst(basePtr, LLVMInt64(offset), "new_base", insertBefore);
-     ptr = new llvm::BitCastInst(ptr, llvm::PointerType::get(type, 0), "ptr_cast", insertBefore);
--#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-     return new llvm::LoadInst(ptr, "gather_load", false /* not volatile */, llvm::MaybeAlign(align), insertBefore);
- #else // LLVM 11.0+
-     return new llvm::LoadInst(llvm::dyn_cast<llvm::PointerType>(ptr->getType())->getPointerElementType(), ptr,
-@@ -6183,7 +6183,7 @@ bool ReplaceLLVMIntrinsics::runOnBasicBlock(llvm::BasicBlock &bb) {
-                 Args.push_back(llvm::ConstantVector::getSplat(
- #if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-                     g->target->getNativeVectorWidth(),
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
-                     {static_cast<unsigned int>(g->target->getNativeVectorWidth()), false},
- #else // LLVM 12.0+
-                     llvm::ElementCount::get(static_cast<unsigned int>(g->target->getNativeVectorWidth()), false),
-@@ -6195,7 +6195,7 @@ bool ReplaceLLVMIntrinsics::runOnBasicBlock(llvm::BasicBlock &bb) {
-                 llvm::Value *zeroMask = llvm::ConstantVector::getSplat(
- #if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-                     g->target->getNativeVectorWidth(),
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
-                     {static_cast<unsigned int>(g->target->getNativeVectorWidth()), false},
- #else // LLVM 12.0+
-                     llvm::ElementCount::get(static_cast<unsigned int>(g->target->getNativeVectorWidth()), false),
-@@ -6567,7 +6567,7 @@ llvm::Value *FixAddressSpace::calculateGatherScatterAddress(llvm::Value *Ptr, ll
-         llvm::Constant *zeroVec = llvm::ConstantVector::getSplat(
- #if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-             addressType->getVectorNumElements(),
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+#elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
-             {llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements(), false},
- #else
-         llvm::ElementCount::get(
diff --git a/srcpkgs/ispc/patches/llvm12-007.patch b/srcpkgs/ispc/patches/llvm12-007.patch
deleted file mode 100644
index 1b975f896c7e..000000000000
--- a/srcpkgs/ispc/patches/llvm12-007.patch
+++ /dev/null
@@ -1,160 +0,0 @@
-From 62f5a6c37bf26fc25a7cf81868052d3472874610 Mon Sep 17 00:00:00 2001
-From: Arina Neshlyaeva <arina.neshlyaeva@intel.com>
-Date: Tue, 23 Mar 2021 23:07:30 -0700
-Subject: [PATCH] Do not generate function mask when it is not required
-
----
- src/ctx.cpp                    | 39 ++++++++++++++-------
- tests/lit-tests/full_mask.ispc | 63 ++++++++++++++++++++++++++++++++++
- 2 files changed, 90 insertions(+), 12 deletions(-)
- create mode 100644 tests/lit-tests/full_mask.ispc
-
-diff --git a/src/ctx.cpp b/src/ctx.cpp
-index 527a02f30..9e775fc5c 100644
---- a/src/ctx.cpp
-+++ b/src/ctx.cpp
-@@ -231,10 +231,18 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym, llvm::F
-     internalMaskPointer = AllocaInst(LLVMTypes::MaskType, "internal_mask_memory");
-     StoreInst(LLVMMaskAllOn, internalMaskPointer);
- 
--    functionMaskValue = LLVMMaskAllOn;
--
--    fullMaskPointer = AllocaInst(LLVMTypes::MaskType, "full_mask_memory");
--    StoreInst(LLVMMaskAllOn, fullMaskPointer);
-+    // If the function doesn't have __mask in parameters, there is no need to
-+    // have function mask
-+    if ((func->GetType()->isExported &&
-+         (lf->getFunctionType()->getNumParams() == func->GetType()->GetNumParameters())) ||
-+        (func->GetType()->isUnmasked) || (func->GetType()->isTask)) {
-+        functionMaskValue = NULL;
-+        fullMaskPointer = NULL;
-+    } else {
-+        functionMaskValue = LLVMMaskAllOn;
-+        fullMaskPointer = AllocaInst(LLVMTypes::MaskType, "full_mask_memory");
-+        StoreInst(LLVMMaskAllOn, fullMaskPointer);
-+    }
- 
-     blockEntryMask = NULL;
-     breakLanesPtr = continueLanesPtr = NULL;
-@@ -389,20 +397,26 @@ llvm::BasicBlock *FunctionEmitContext::GetCurrentBasicBlock() { return bblock; }
- 
- void FunctionEmitContext::SetCurrentBasicBlock(llvm::BasicBlock *bb) { bblock = bb; }
- 
--llvm::Value *FunctionEmitContext::GetFunctionMask() { return functionMaskValue; }
-+llvm::Value *FunctionEmitContext::GetFunctionMask() { return fullMaskPointer ? functionMaskValue : LLVMMaskAllOn; }
- 
- llvm::Value *FunctionEmitContext::GetInternalMask() { return LoadInst(internalMaskPointer, NULL, "load_mask"); }
- 
- llvm::Value *FunctionEmitContext::GetFullMask() {
--    return BinaryOperator(llvm::Instruction::And, GetInternalMask(), functionMaskValue, "internal_mask&function_mask");
-+    return fullMaskPointer ? BinaryOperator(llvm::Instruction::And, GetInternalMask(), functionMaskValue,
-+                                            "internal_mask&function_mask")
-+                           : GetInternalMask();
- }
- 
--llvm::Value *FunctionEmitContext::GetFullMaskPointer() { return fullMaskPointer; }
-+llvm::Value *FunctionEmitContext::GetFullMaskPointer() {
-+    return fullMaskPointer ? fullMaskPointer : internalMaskPointer;
-+}
- 
- void FunctionEmitContext::SetFunctionMask(llvm::Value *value) {
--    functionMaskValue = value;
--    if (bblock != NULL)
--        StoreInst(GetFullMask(), fullMaskPointer);
-+    if (fullMaskPointer != NULL) {
-+        functionMaskValue = value;
-+        if (bblock != NULL)
-+            StoreInst(GetFullMask(), fullMaskPointer);
-+    }
- }
- 
- void FunctionEmitContext::SetBlockEntryMask(llvm::Value *value) { blockEntryMask = value; }
-@@ -410,7 +424,8 @@ void FunctionEmitContext::SetBlockEntryMask(llvm::Value *value) { blockEntryMask
- void FunctionEmitContext::SetInternalMask(llvm::Value *value) {
-     StoreInst(value, internalMaskPointer);
-     // kludge so that __mask returns the right value in ispc code.
--    StoreInst(GetFullMask(), fullMaskPointer);
-+    if (fullMaskPointer)
-+        StoreInst(GetFullMask(), fullMaskPointer);
- }
- 
- void FunctionEmitContext::SetInternalMaskAnd(llvm::Value *oldMask, llvm::Value *test) {
-@@ -1265,7 +1280,7 @@ void FunctionEmitContext::CurrentLanesReturned(Expr *expr, bool doCoherenceCheck
-         // lanes have returned
-         if (doCoherenceCheck) {
-             // if newReturnedLanes == functionMaskValue, get out of here!
--            llvm::Value *cmp = MasksAllEqual(functionMaskValue, newReturnedLanes);
-+            llvm::Value *cmp = MasksAllEqual(GetFunctionMask(), newReturnedLanes);
-             llvm::BasicBlock *bDoReturn = CreateBasicBlock("do_return");
-             llvm::BasicBlock *bNoReturn = CreateBasicBlock("no_return");
-             BranchInst(bDoReturn, bNoReturn, cmp);
-diff --git a/tests/lit-tests/full_mask.ispc b/tests/lit-tests/full_mask.ispc
-new file mode 100644
-index 000000000..ac0b0bca3
---- /dev/null
-+++ b/tests/lit-tests/full_mask.ispc
-@@ -0,0 +1,63 @@
-+// RUN: %{ispc} %s -DISPC_EXPORT --emit-llvm-text -O0 --nowrap -o %t.ll
-+// RUN: FileCheck --input-file=%t.ll -check-prefix=CHECK_ISPC_EXPORT %s
-+
-+// RUN: %{ispc} %s -DISPC_UNMASKED --emit-llvm-text -O0 --nowrap -o %t.ll
-+// RUN: FileCheck --input-file=%t.ll -check-prefix=CHECK_ISPC_UNMASKED %s
-+
-+// RUN: %{ispc} %s -DISPC_NOQUALIF --emit-llvm-text -O0 --nowrap -o %t.ll
-+// RUN: FileCheck --input-file=%t.ll -check-prefix=CHECK_ISPC_NOQUALIF %s
-+
-+// RUN: %{ispc} %s -DISPC_TASK --emit-llvm-text -O0 --nowrap -o %t.ll
-+// RUN: FileCheck --input-file=%t.ll -check-prefix=CHECK_ISPC_TASK %s
-+
-+struct Parameters {
-+    float *vout;
-+    int param;
-+};
-+
-+#ifdef ISPC_EXPORT
-+// CHECK_ISPC_EXPORT: define void @simple_export___
-+// CHECK_ISPC_EXPORT: %full_mask_memory = alloca
-+// CHECK_ISPC_EXPORT: define void @simple_export(
-+// CHECK_ISPC_EXPORT-NOT: %full_mask_memory = alloca
-+export void simple_export(void *uniform _p) {
-+    Parameters *uniform p = (Parameters * uniform) _p;
-+    if (programIndex > p->param)
-+        p->vout[programIndex] = programCount * programIndex;
-+}
-+#endif
-+#ifdef ISPC_UNMASKED
-+// CHECK_ISPC_UNMASKED: define void @simple_unmasked
-+// CHECK_ISPC_UNMASKED-NOT: %full_mask_memory = alloca
-+unmasked void simple_unmasked(void *uniform _p) {
-+    Parameters *uniform p = (Parameters * uniform) _p;
-+    if (programIndex > p->param)
-+        p->vout[programIndex] = programCount * programIndex;
-+}
-+#endif
-+#ifdef ISPC_NOQUALIF
-+// CHECK_ISPC_NOQUALIF: define void @simple
-+// CHECK_ISPC_NOQUALIF: %full_mask_memory = alloca
-+void simple(void *uniform _p) {
-+    Parameters *uniform p = (Parameters * uniform) _p;
-+    if (programIndex > p->param)
-+        p->vout[programIndex] = programCount * programIndex;
-+}
-+#endif
-+#ifdef ISPC_TASK
-+
-+// CHECK_ISPC_TASK: define void @simple_task
-+// CHECK_ISPC_TASK-NOT: %full_mask_memory = alloca
-+// CHECK_ISPC_TASK: define void @simple_entry_point__
-+// CHECK_ISPC_TASK: %full_mask_memory = alloca
-+// CHECK_ISPC_TASK: define void @simple_entry_point(
-+// CHECK_ISPC_TASK-NOT: %full_mask_memory = alloca
-+task void simple_task(void *uniform _p) {
-+    Parameters *uniform p = (Parameters * uniform) _p;
-+    if (programIndex > p->param)
-+        p->vout[programIndex] = programCount * programIndex;
-+}
-+export void simple_entry_point(void *uniform parameters, uniform int dim0, uniform int dim1, uniform int dim2) {
-+    launch[dim0, dim1, dim2] simple_task(parameters);
-+}
-+#endif
-\ No newline at end of file
diff --git a/srcpkgs/ispc/patches/llvm12-008.patch b/srcpkgs/ispc/patches/llvm12-008.patch
deleted file mode 100644
index c8413d8b7887..000000000000
--- a/srcpkgs/ispc/patches/llvm12-008.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From afad14227d9204a3c8a626ca608f5b43c3218fe9 Mon Sep 17 00:00:00 2001
-From: Arina Neshlyaeva <arina.neshlyaeva@intel.com>
-Date: Tue, 4 May 2021 11:43:52 -0700
-Subject: [PATCH] Fixed ISPC gen build for LLVM12
-
----
- src/ctx.cpp |  4 ++++
- src/opt.cpp | 43 +++++++++++++++++++++++++++++--------------
- 2 files changed, 33 insertions(+), 14 deletions(-)
-
-diff --git a/src/ctx.cpp b/src/ctx.cpp
-index 0c7050591..f7dc06939 100644
---- a/src/ctx.cpp
-+++ b/src/ctx.cpp
-@@ -3738,7 +3738,11 @@ llvm::Value *FunctionEmitContext::GenXSimdCFAny(llvm::Value *value) {
- 
- llvm::Value *FunctionEmitContext::GenXSimdCFPredicate(llvm::Value *value, llvm::Value *defaults) {
-     AssertPos(currentPos, llvm::isa<llvm::VectorType>(value->getType()));
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+    llvm::FixedVectorType *vt = llvm::dyn_cast<llvm::FixedVectorType>(value->getType());
-+#else
-     llvm::VectorType *vt = llvm::dyn_cast<llvm::VectorType>(value->getType());
-+#endif
-     if (defaults == NULL) {
- #if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-         defaults = llvm::ConstantVector::getSplat(vt->getVectorNumElements(),
-diff --git a/src/opt.cpp b/src/opt.cpp
-index cea4afa23..4e33d6b1a 100644
---- a/src/opt.cpp
-+++ b/src/opt.cpp
-@@ -2916,9 +2916,13 @@ static llvm::Function *lGenXMaskedInt8Inst(llvm::Instruction *inst, bool isStore
- 
- static llvm::CallInst *lGenXStoreInst(llvm::Value *val, llvm::Value *ptr, llvm::Instruction *inst) {
-     Assert(g->target->isGenXTarget());
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+    Assert(llvm::isa<llvm::FixedVectorType>(val->getType()));
-+    llvm::FixedVectorType *valVecType = llvm::dyn_cast<llvm::FixedVectorType>(val->getType());
-+#else
-     Assert(llvm::isa<llvm::VectorType>(val->getType()));
--
-     llvm::VectorType *valVecType = llvm::dyn_cast<llvm::VectorType>(val->getType());
-+#endif
-     Assert(llvm::isPowerOf2_32(valVecType->getNumElements()));
-     Assert(valVecType->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
- 
-@@ -2942,9 +2946,13 @@ static llvm::CallInst *lGenXStoreInst(llvm::Value *val, llvm::Value *ptr, llvm::
- }
- 
- static llvm::CallInst *lGenXLoadInst(llvm::Value *ptr, llvm::Type *retType, llvm::Instruction *inst) {
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+    Assert(llvm::isa<llvm::FixedVectorType>(retType));
-+    llvm::FixedVectorType *retVecType = llvm::dyn_cast<llvm::FixedVectorType>(retType);
-+#else
-     Assert(llvm::isa<llvm::VectorType>(retType));
--
-     llvm::VectorType *retVecType = llvm::dyn_cast<llvm::VectorType>(retType);
-+#endif
-     Assert(llvm::isPowerOf2_32(retVecType->getNumElements()));
-     Assert(retVecType->getPrimitiveSizeInBits());
-     Assert(retVecType->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
-@@ -5485,8 +5493,13 @@ static void lCreateBlockLDUse(llvm::Instruction *currInst, std::vector<llvm::Ext
-         } else if (auto gather = lGetPseudoGather(llvm::dyn_cast<llvm::Instruction>(ui->getUser()))) {
-             // Collect idxs from gather and fix users
-             llvm::Value *res = llvm::UndefValue::get(gather->getType());
--            for (unsigned i = 0, end = llvm::dyn_cast<llvm::VectorType>(res->getType())->getNumElements(); i < end;
--                 ++i) {
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+            for (unsigned i = 0, end = llvm::dyn_cast<llvm::FixedVectorType>(res->getType())->getNumElements(); i < end;
-+                 ++i)
-+#else
-+            for (unsigned i = 0, end = llvm::dyn_cast<llvm::VectorType>(res->getType())->getNumElements(); i < end; ++i)
-+#endif
-+            {
-                 // Get element via IEI
-                 res = llvm::InsertElementInst::Create(res, EEIs[ptrUse.idxs[curr_idx++]],
-                                                       llvm::ConstantInt::get(LLVMTypes::Int32Type, i),
-@@ -5522,10 +5535,11 @@ static bool lVectorizeGEPs(llvm::Value *ptr, std::vector<PtrUse> &ptrUses, std::
- 
-     // Adjust values for vector load
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
--    if (auto vecTy = llvm::dyn_cast<llvm::FixedVectorType>(type)) {
-+    if (auto vecTy = llvm::dyn_cast<llvm::FixedVectorType>(type))
- #else
--    if (auto vecTy = llvm::dyn_cast<llvm::VectorType>(type)) {
-+    if (auto vecTy = llvm::dyn_cast<llvm::VectorType>(type))
- #endif
-+    {
-         // Get single element size
-         t_size /= vecTy->getNumElements();
-         // Get single element type
-@@ -6477,7 +6491,7 @@ llvm::Value *FixAddressSpace::calculateGatherScatterAddress(llvm::Value *Ptr, ll
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-         Offsets,
-         llvm::FixedVectorType::get(LLVMTypes::Int64Type,
--                                   llvm::dyn_cast<llvm::VectorType>(Offsets->getType())->getNumElements()),
-+                                   llvm::dyn_cast<llvm::FixedVectorType>(Offsets->getType())->getNumElements()),
-         "svm_offset_zext", InsertBefore);
- #else
-         Offsets, llvm::VectorType::get(LLVMTypes::Int64Type, Offsets->getType()->getVectorNumElements()),
-@@ -6492,7 +6506,7 @@ llvm::Value *FixAddressSpace::calculateGatherScatterAddress(llvm::Value *Ptr, ll
-         llvm::Value *undefInsertValue =
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-             llvm::UndefValue::get(llvm::FixedVectorType::get(
--                LLVMTypes::Int64Type, llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements()));
-+                LLVMTypes::Int64Type, llvm::dyn_cast<llvm::FixedVectorType>(addressType)->getNumElements()));
- #else
-             llvm::UndefValue::get(llvm::VectorType::get(LLVMTypes::Int64Type, addressType->getVectorNumElements()));
- #endif
-@@ -6501,17 +6515,16 @@ llvm::Value *FixAddressSpace::calculateGatherScatterAddress(llvm::Value *Ptr, ll
- #if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-             addressType->getVectorNumElements(),
- #elif ISPC_LLVM_VERSION < ISPC_LLVM_12_0
--            {llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements(), false},
-+            {llvm::dyn_cast<llvm::FixedVectorType>(addressType)->getNumElements(), false},
- #else
--        llvm::ElementCount::get(
--                                llvm::dyn_cast<llvm::FixedVectorType>(addressType->getNumElements(), false),
-+            llvm::ElementCount::get(llvm::dyn_cast<llvm::FixedVectorType>(addressType)->getNumElements(), false),
- #endif
-             llvm::Constant::getNullValue(llvm::Type::getInt32Ty(InsertBefore->getContext())));
- 
-         llvm::Value *undefShuffleValue =
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-             llvm::UndefValue::get(llvm::FixedVectorType::get(
--                LLVMTypes::Int64Type, llvm::dyn_cast<llvm::VectorType>(addressType)->getNumElements()));
-+                LLVMTypes::Int64Type, llvm::dyn_cast<llvm::FixedVectorType>(addressType)->getNumElements()));
- #else
-             llvm::UndefValue::get(llvm::VectorType::get(LLVMTypes::Int64Type, addressType->getVectorNumElements()));
- #endif
-@@ -6542,7 +6555,8 @@ llvm::Instruction *FixAddressSpace::processVectorLoad(llvm::LoadInst *LI) {
-         isPtrLoad = true;
-         auto scalarType = g->target->is32Bit() ? LLVMTypes::Int32Type : LLVMTypes::Int64Type;
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
--        retType = llvm::FixedVectorType::get(scalarType, llvm::dyn_cast<llvm::VectorType>(retType)->getNumElements());
-+        retType =
-+            llvm::FixedVectorType::get(scalarType, llvm::dyn_cast<llvm::FixedVectorType>(retType)->getNumElements());
- #else
-         retType = llvm::VectorType::get(scalarType, retType->getVectorNumElements());
- #endif
-@@ -6604,7 +6618,8 @@ llvm::Instruction *FixAddressSpace::processVectorStore(llvm::StoreInst *SI) {
-     if (valType->getScalarType()->isPointerTy()) {
-         auto scalarType = g->target->is32Bit() ? LLVMTypes::Int32Type : LLVMTypes::Int64Type;
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
--        valType = llvm::FixedVectorType::get(scalarType, llvm::dyn_cast<llvm::VectorType>(valType)->getNumElements());
-+        valType =
-+            llvm::FixedVectorType::get(scalarType, llvm::dyn_cast<llvm::FixedVectorType>(valType)->getNumElements());
- #else
-         valType = llvm::VectorType::get(scalarType, valType->getVectorNumElements());
- #endif
diff --git a/srcpkgs/ispc/patches/llvm12-009.patch b/srcpkgs/ispc/patches/llvm12-009.patch
deleted file mode 100644
index d3ea67828582..000000000000
--- a/srcpkgs/ispc/patches/llvm12-009.patch
+++ /dev/null
@@ -1,2109 +0,0 @@
-From 97b13c32132e2704a5e3e7b2eae49d854d087e3e Mon Sep 17 00:00:00 2001
-From: Arina Neshlyaeva <arina.neshlyaeva@intel.com>
-Date: Tue, 4 May 2021 11:31:55 -0700
-Subject: [PATCH] Updated builtins-cm* for switch to LLVM12
-
----
- builtins/builtins-cm-32.ll | 234 ++++++++++++++++++-------------------
- builtins/builtins-cm-64.ll | 232 ++++++++++++++++++------------------
- 2 files changed, 233 insertions(+), 233 deletions(-)
-
-diff --git a/builtins/builtins-cm-32.ll b/builtins/builtins-cm-32.ll
-index 32debf32e..481bbdc48 100644
---- a/builtins/builtins-cm-32.ll
-+++ b/builtins/builtins-cm-32.ll
-@@ -557,7 +557,7 @@ $_ZN13VaryingWriter12WriteVecElemIPvEEvv = comdat any
- @.str.10 = private unnamed_addr constant [5 x i8] c"%08X\00", align 1
- 
- ; Function Attrs: noinline nounwind
--define dso_local signext i8 @_Z24__cm_intrinsic_impl_sdivcc(i8 signext, i8 signext) #0 {
-+define internal signext i8 @_Z24__cm_intrinsic_impl_sdivcc(i8 signext, i8 signext) #0 {
-   %3 = alloca i8, align 1
-   %4 = alloca i8, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -618,7 +618,7 @@ define internal <1 x i8> @_ZN7details13__impl_divremILi1EEEu2CMvbT__cS1_S1_u2CMv
- declare <1 x i8> @llvm.genx.rdregioni.v1i8.v1i8.i16(<1 x i8>, i32, i32, i32, i16, i32) #2
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_cS_(<1 x i8>, <1 x i8>) #0 {
-+define internal <1 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_cS_(<1 x i8>, <1 x i8>) #0 {
-   %3 = alloca <1 x i8>, align 1
-   %4 = alloca <1 x i8>, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -634,7 +634,7 @@ define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_cS_(<1 x i8>, <1
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb2_cS_(<2 x i8>, <2 x i8>) #3 {
-+define internal <2 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb2_cS_(<2 x i8>, <2 x i8>) #3 {
-   %3 = alloca <2 x i8>, align 2
-   %4 = alloca <2 x i8>, align 2
-   %5 = alloca <2 x i8>, align 2
-@@ -680,7 +680,7 @@ define internal <2 x i8> @_ZN7details13__impl_divremILi2EEEu2CMvbT__cS1_S1_u2CMv
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb4_cS_(<4 x i8>, <4 x i8>) #5 {
-+define internal <4 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb4_cS_(<4 x i8>, <4 x i8>) #5 {
-   %3 = alloca <4 x i8>, align 4
-   %4 = alloca <4 x i8>, align 4
-   %5 = alloca <4 x i8>, align 4
-@@ -818,7 +818,7 @@ define internal <16 x i8> @_ZN7details13__impl_divremILi16EEEu2CMvbT__cS1_S1_u2C
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb32_cS_(<32 x i8>, <32 x i8>) #11 {
-+define internal <32 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb32_cS_(<32 x i8>, <32 x i8>) #11 {
-   %3 = alloca <32 x i8>, align 32
-   %4 = alloca <32 x i8>, align 32
-   %5 = alloca <32 x i8>, align 32
-@@ -864,7 +864,7 @@ define internal <32 x i8> @_ZN7details13__impl_divremILi32EEEu2CMvbT__cS1_S1_u2C
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local signext i8 @_Z24__cm_intrinsic_impl_sremcc(i8 signext, i8 signext) #0 {
-+define internal signext i8 @_Z24__cm_intrinsic_impl_sremcc(i8 signext, i8 signext) #0 {
-   %3 = alloca i8, align 1
-   %4 = alloca i8, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -890,7 +890,7 @@ define dso_local signext i8 @_Z24__cm_intrinsic_impl_sremcc(i8 signext, i8 signe
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb1_cS_(<1 x i8>, <1 x i8>) #0 {
-+define internal <1 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb1_cS_(<1 x i8>, <1 x i8>) #0 {
-   %3 = alloca <1 x i8>, align 1
-   %4 = alloca <1 x i8>, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -904,7 +904,7 @@ define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb1_cS_(<1 x i8>, <1
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb2_cS_(<2 x i8>, <2 x i8>) #3 {
-+define internal <2 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb2_cS_(<2 x i8>, <2 x i8>) #3 {
-   %3 = alloca <2 x i8>, align 2
-   %4 = alloca <2 x i8>, align 2
-   %5 = alloca <2 x i8>, align 2
-@@ -918,7 +918,7 @@ define dso_local <2 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb2_cS_(<2 x i8>, <2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb4_cS_(<4 x i8>, <4 x i8>) #5 {
-+define internal <4 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb4_cS_(<4 x i8>, <4 x i8>) #5 {
-   %3 = alloca <4 x i8>, align 4
-   %4 = alloca <4 x i8>, align 4
-   %5 = alloca <4 x i8>, align 4
-@@ -932,7 +932,7 @@ define dso_local <4 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb4_cS_(<4 x i8>, <4
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <8 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb8_cS_(<8 x i8>, <8 x i8>) #7 {
-+define internal <8 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb8_cS_(<8 x i8>, <8 x i8>) #7 {
-   %3 = alloca <8 x i8>, align 8
-   %4 = alloca <8 x i8>, align 8
-   %5 = alloca <8 x i8>, align 8
-@@ -946,7 +946,7 @@ define dso_local <8 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb8_cS_(<8 x i8>, <8
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <16 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb16_cS_(<16 x i8>, <16 x i8>) #9 {
-+define internal <16 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb16_cS_(<16 x i8>, <16 x i8>) #9 {
-   %3 = alloca <16 x i8>, align 16
-   %4 = alloca <16 x i8>, align 16
-   %5 = alloca <16 x i8>, align 16
-@@ -960,7 +960,7 @@ define dso_local <16 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb16_cS_(<16 x i8>,
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb32_cS_(<32 x i8>, <32 x i8>) #11 {
-+define internal <32 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb32_cS_(<32 x i8>, <32 x i8>) #11 {
-   %3 = alloca <32 x i8>, align 32
-   %4 = alloca <32 x i8>, align 32
-   %5 = alloca <32 x i8>, align 32
-@@ -974,7 +974,7 @@ define dso_local <32 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb32_cS_(<32 x i8>,
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local signext i16 @_Z24__cm_intrinsic_impl_sdivss(i16 signext, i16 signext) #3 {
-+define internal signext i16 @_Z24__cm_intrinsic_impl_sdivss(i16 signext, i16 signext) #3 {
-   %3 = alloca i16, align 2
-   %4 = alloca i16, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -1058,7 +1058,7 @@ define internal <1 x i16> @_ZN7details13__impl_divremILi1EEEu2CMvbT__sS1_S1_u2CM
- declare <1 x i16> @llvm.genx.rdregioni.v1i16.v1i16.i16(<1 x i16>, i32, i32, i32, i16, i32) #2
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_sS_(<1 x i16>, <1 x i16>) #3 {
-+define internal <1 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_sS_(<1 x i16>, <1 x i16>) #3 {
-   %3 = alloca <1 x i16>, align 2
-   %4 = alloca <1 x i16>, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -1074,7 +1074,7 @@ define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_sS_(<1 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb2_sS_(<2 x i16>, <2 x i16>) #5 {
-+define internal <2 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb2_sS_(<2 x i16>, <2 x i16>) #5 {
-   %3 = alloca <2 x i16>, align 4
-   %4 = alloca <2 x i16>, align 4
-   %5 = alloca <2 x i16>, align 4
-@@ -1143,7 +1143,7 @@ define internal <2 x i16> @_ZN7details13__impl_divremILi2EEEu2CMvbT__sS1_S1_u2CM
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb4_sS_(<4 x i16>, <4 x i16>) #7 {
-+define internal <4 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb4_sS_(<4 x i16>, <4 x i16>) #7 {
-   %3 = alloca <4 x i16>, align 8
-   %4 = alloca <4 x i16>, align 8
-   %5 = alloca <4 x i16>, align 8
-@@ -1350,7 +1350,7 @@ define internal <16 x i16> @_ZN7details13__impl_divremILi16EEEu2CMvbT__sS1_S1_u2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb32_sS_(<32 x i16>, <32 x i16>) #13 {
-+define internal <32 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb32_sS_(<32 x i16>, <32 x i16>) #13 {
-   %3 = alloca <32 x i16>, align 64
-   %4 = alloca <32 x i16>, align 64
-   %5 = alloca <32 x i16>, align 64
-@@ -1419,7 +1419,7 @@ define internal <32 x i16> @_ZN7details13__impl_divremILi32EEEu2CMvbT__sS1_S1_u2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local signext i16 @_Z24__cm_intrinsic_impl_sremss(i16 signext, i16 signext) #3 {
-+define internal signext i16 @_Z24__cm_intrinsic_impl_sremss(i16 signext, i16 signext) #3 {
-   %3 = alloca i16, align 2
-   %4 = alloca i16, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -1445,7 +1445,7 @@ define dso_local signext i16 @_Z24__cm_intrinsic_impl_sremss(i16 signext, i16 si
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb1_sS_(<1 x i16>, <1 x i16>) #3 {
-+define internal <1 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb1_sS_(<1 x i16>, <1 x i16>) #3 {
-   %3 = alloca <1 x i16>, align 2
-   %4 = alloca <1 x i16>, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -1459,7 +1459,7 @@ define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb1_sS_(<1 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb2_sS_(<2 x i16>, <2 x i16>) #5 {
-+define internal <2 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb2_sS_(<2 x i16>, <2 x i16>) #5 {
-   %3 = alloca <2 x i16>, align 4
-   %4 = alloca <2 x i16>, align 4
-   %5 = alloca <2 x i16>, align 4
-@@ -1473,7 +1473,7 @@ define dso_local <2 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb2_sS_(<2 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb4_sS_(<4 x i16>, <4 x i16>) #7 {
-+define internal <4 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb4_sS_(<4 x i16>, <4 x i16>) #7 {
-   %3 = alloca <4 x i16>, align 8
-   %4 = alloca <4 x i16>, align 8
-   %5 = alloca <4 x i16>, align 8
-@@ -1487,7 +1487,7 @@ define dso_local <4 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb4_sS_(<4 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <8 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb8_sS_(<8 x i16>, <8 x i16>) #9 {
-+define internal <8 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb8_sS_(<8 x i16>, <8 x i16>) #9 {
-   %3 = alloca <8 x i16>, align 16
-   %4 = alloca <8 x i16>, align 16
-   %5 = alloca <8 x i16>, align 16
-@@ -1501,7 +1501,7 @@ define dso_local <8 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb8_sS_(<8 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <16 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb16_sS_(<16 x i16>, <16 x i16>) #11 {
-+define internal <16 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb16_sS_(<16 x i16>, <16 x i16>) #11 {
-   %3 = alloca <16 x i16>, align 32
-   %4 = alloca <16 x i16>, align 32
-   %5 = alloca <16 x i16>, align 32
-@@ -1515,7 +1515,7 @@ define dso_local <16 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb16_sS_(<16 x i16>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb32_sS_(<32 x i16>, <32 x i16>) #13 {
-+define internal <32 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb32_sS_(<32 x i16>, <32 x i16>) #13 {
-   %3 = alloca <32 x i16>, align 64
-   %4 = alloca <32 x i16>, align 64
-   %5 = alloca <32 x i16>, align 64
-@@ -1529,7 +1529,7 @@ define dso_local <32 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb32_sS_(<32 x i16>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local i32 @_Z24__cm_intrinsic_impl_sdivii(i32, i32) #14 {
-+define internal i32 @_Z24__cm_intrinsic_impl_sdivii(i32, i32) #14 {
-   %3 = alloca i32, align 4
-   %4 = alloca i32, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -1730,7 +1730,7 @@ define internal <1 x i32> @_ZN7details13__impl_divremILi1EEEu2CMvbT__iS1_S1_u2CM
- declare <1 x i32> @llvm.genx.rdregioni.v1i32.v1i32.i16(<1 x i32>, i32, i32, i32, i16, i32) #2
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_iS_(<1 x i32>, <1 x i32>) #14 {
-+define internal <1 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_iS_(<1 x i32>, <1 x i32>) #14 {
-   %3 = alloca <1 x i32>, align 4
-   %4 = alloca <1 x i32>, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -1746,7 +1746,7 @@ define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_iS_(<1 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb2_iS_(<2 x i32>, <2 x i32>) #15 {
-+define internal <2 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb2_iS_(<2 x i32>, <2 x i32>) #15 {
-   %3 = alloca <2 x i32>, align 8
-   %4 = alloca <2 x i32>, align 8
-   %5 = alloca <2 x i32>, align 8
-@@ -1932,7 +1932,7 @@ define internal <2 x i32> @_ZN7details13__impl_divremILi2EEEu2CMvbT__iS1_S1_u2CM
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb4_iS_(<4 x i32>, <4 x i32>) #16 {
-+define internal <4 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb4_iS_(<4 x i32>, <4 x i32>) #16 {
-   %3 = alloca <4 x i32>, align 16
-   %4 = alloca <4 x i32>, align 16
-   %5 = alloca <4 x i32>, align 16
-@@ -2490,7 +2490,7 @@ define internal <16 x i32> @_ZN7details13__impl_divremILi16EEEu2CMvbT__iS1_S1_u2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb32_iS_(<32 x i32>, <32 x i32>) #19 {
-+define internal <32 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb32_iS_(<32 x i32>, <32 x i32>) #19 {
-   %3 = alloca <32 x i32>, align 128
-   %4 = alloca <32 x i32>, align 128
-   %5 = alloca <32 x i32>, align 128
-@@ -2676,7 +2676,7 @@ define internal <32 x i32> @_ZN7details13__impl_divremILi32EEEu2CMvbT__iS1_S1_u2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local i32 @_Z24__cm_intrinsic_impl_sremii(i32, i32) #14 {
-+define internal i32 @_Z24__cm_intrinsic_impl_sremii(i32, i32) #14 {
-   %3 = alloca i32, align 4
-   %4 = alloca i32, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -2702,7 +2702,7 @@ define dso_local i32 @_Z24__cm_intrinsic_impl_sremii(i32, i32) #14 {
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb1_iS_(<1 x i32>, <1 x i32>) #14 {
-+define internal <1 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb1_iS_(<1 x i32>, <1 x i32>) #14 {
-   %3 = alloca <1 x i32>, align 4
-   %4 = alloca <1 x i32>, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -2716,7 +2716,7 @@ define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb1_iS_(<1 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb2_iS_(<2 x i32>, <2 x i32>) #15 {
-+define internal <2 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb2_iS_(<2 x i32>, <2 x i32>) #15 {
-   %3 = alloca <2 x i32>, align 8
-   %4 = alloca <2 x i32>, align 8
-   %5 = alloca <2 x i32>, align 8
-@@ -2730,7 +2730,7 @@ define dso_local <2 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb2_iS_(<2 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb4_iS_(<4 x i32>, <4 x i32>) #16 {
-+define internal <4 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb4_iS_(<4 x i32>, <4 x i32>) #16 {
-   %3 = alloca <4 x i32>, align 16
-   %4 = alloca <4 x i32>, align 16
-   %5 = alloca <4 x i32>, align 16
-@@ -2744,7 +2744,7 @@ define dso_local <4 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb4_iS_(<4 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <8 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb8_iS_(<8 x i32>, <8 x i32>) #17 {
-+define internal <8 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb8_iS_(<8 x i32>, <8 x i32>) #17 {
-   %3 = alloca <8 x i32>, align 32
-   %4 = alloca <8 x i32>, align 32
-   %5 = alloca <8 x i32>, align 32
-@@ -2758,7 +2758,7 @@ define dso_local <8 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb8_iS_(<8 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <16 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb16_iS_(<16 x i32>, <16 x i32>) #18 {
-+define internal <16 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb16_iS_(<16 x i32>, <16 x i32>) #18 {
-   %3 = alloca <16 x i32>, align 64
-   %4 = alloca <16 x i32>, align 64
-   %5 = alloca <16 x i32>, align 64
-@@ -2772,7 +2772,7 @@ define dso_local <16 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb16_iS_(<16 x i32>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb32_iS_(<32 x i32>, <32 x i32>) #19 {
-+define internal <32 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb32_iS_(<32 x i32>, <32 x i32>) #19 {
-   %3 = alloca <32 x i32>, align 128
-   %4 = alloca <32 x i32>, align 128
-   %5 = alloca <32 x i32>, align 128
-@@ -2786,7 +2786,7 @@ define dso_local <32 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb32_iS_(<32 x i32>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local zeroext i8 @_Z24__cm_intrinsic_impl_udivhh(i8 zeroext, i8 zeroext) #21 {
-+define internal zeroext i8 @_Z24__cm_intrinsic_impl_udivhh(i8 zeroext, i8 zeroext) #21 {
-   %3 = alloca i8, align 1
-   %4 = alloca i8, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -2844,7 +2844,7 @@ define internal <1 x i8> @_ZN7details14__impl_udivremILi1EEEu2CMvbT__hS1_S1_u2CM
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb1_hS_(<1 x i8>, <1 x i8>) #21 {
-+define internal <1 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb1_hS_(<1 x i8>, <1 x i8>) #21 {
-   %3 = alloca <1 x i8>, align 1
-   %4 = alloca <1 x i8>, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -2860,7 +2860,7 @@ define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb1_hS_(<1 x i8>, <1
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb2_hS_(<2 x i8>, <2 x i8>) #22 {
-+define internal <2 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb2_hS_(<2 x i8>, <2 x i8>) #22 {
-   %3 = alloca <2 x i8>, align 2
-   %4 = alloca <2 x i8>, align 2
-   %5 = alloca <2 x i8>, align 2
-@@ -2906,7 +2906,7 @@ define internal <2 x i8> @_ZN7details14__impl_udivremILi2EEEu2CMvbT__hS1_S1_u2CM
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb4_hS_(<4 x i8>, <4 x i8>) #14 {
-+define internal <4 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb4_hS_(<4 x i8>, <4 x i8>) #14 {
-   %3 = alloca <4 x i8>, align 4
-   %4 = alloca <4 x i8>, align 4
-   %5 = alloca <4 x i8>, align 4
-@@ -3044,7 +3044,7 @@ define internal <16 x i8> @_ZN7details14__impl_udivremILi16EEEu2CMvbT__hS1_S1_u2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb32_hS_(<32 x i8>, <32 x i8>) #17 {
-+define internal <32 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb32_hS_(<32 x i8>, <32 x i8>) #17 {
-   %3 = alloca <32 x i8>, align 32
-   %4 = alloca <32 x i8>, align 32
-   %5 = alloca <32 x i8>, align 32
-@@ -3090,7 +3090,7 @@ define internal <32 x i8> @_ZN7details14__impl_udivremILi32EEEu2CMvbT__hS1_S1_u2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local zeroext i8 @_Z24__cm_intrinsic_impl_uremhh(i8 zeroext, i8 zeroext) #21 {
-+define internal zeroext i8 @_Z24__cm_intrinsic_impl_uremhh(i8 zeroext, i8 zeroext) #21 {
-   %3 = alloca i8, align 1
-   %4 = alloca i8, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -3116,7 +3116,7 @@ define dso_local zeroext i8 @_Z24__cm_intrinsic_impl_uremhh(i8 zeroext, i8 zeroe
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb1_hS_(<1 x i8>, <1 x i8>) #21 {
-+define internal <1 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb1_hS_(<1 x i8>, <1 x i8>) #21 {
-   %3 = alloca <1 x i8>, align 1
-   %4 = alloca <1 x i8>, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -3130,7 +3130,7 @@ define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb1_hS_(<1 x i8>, <1
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb2_hS_(<2 x i8>, <2 x i8>) #22 {
-+define internal <2 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb2_hS_(<2 x i8>, <2 x i8>) #22 {
-   %3 = alloca <2 x i8>, align 2
-   %4 = alloca <2 x i8>, align 2
-   %5 = alloca <2 x i8>, align 2
-@@ -3144,7 +3144,7 @@ define dso_local <2 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb2_hS_(<2 x i8>, <2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb4_hS_(<4 x i8>, <4 x i8>) #14 {
-+define internal <4 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb4_hS_(<4 x i8>, <4 x i8>) #14 {
-   %3 = alloca <4 x i8>, align 4
-   %4 = alloca <4 x i8>, align 4
-   %5 = alloca <4 x i8>, align 4
-@@ -3158,7 +3158,7 @@ define dso_local <4 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb4_hS_(<4 x i8>, <4
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <8 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb8_hS_(<8 x i8>, <8 x i8>) #15 {
-+define internal <8 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb8_hS_(<8 x i8>, <8 x i8>) #15 {
-   %3 = alloca <8 x i8>, align 8
-   %4 = alloca <8 x i8>, align 8
-   %5 = alloca <8 x i8>, align 8
-@@ -3172,7 +3172,7 @@ define dso_local <8 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb8_hS_(<8 x i8>, <8
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <16 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb16_hS_(<16 x i8>, <16 x i8>) #16 {
-+define internal <16 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb16_hS_(<16 x i8>, <16 x i8>) #16 {
-   %3 = alloca <16 x i8>, align 16
-   %4 = alloca <16 x i8>, align 16
-   %5 = alloca <16 x i8>, align 16
-@@ -3186,7 +3186,7 @@ define dso_local <16 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb16_hS_(<16 x i8>,
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb32_hS_(<32 x i8>, <32 x i8>) #17 {
-+define internal <32 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb32_hS_(<32 x i8>, <32 x i8>) #17 {
-   %3 = alloca <32 x i8>, align 32
-   %4 = alloca <32 x i8>, align 32
-   %5 = alloca <32 x i8>, align 32
-@@ -3200,7 +3200,7 @@ define dso_local <32 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb32_hS_(<32 x i8>,
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local zeroext i16 @_Z24__cm_intrinsic_impl_udivtt(i16 zeroext, i16 zeroext) #22 {
-+define internal zeroext i16 @_Z24__cm_intrinsic_impl_udivtt(i16 zeroext, i16 zeroext) #22 {
-   %3 = alloca i16, align 2
-   %4 = alloca i16, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -3278,7 +3278,7 @@ define internal <1 x i16> @_ZN7details14__impl_udivremILi1EEEu2CMvbT__tS1_S1_u2C
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb1_tS_(<1 x i16>, <1 x i16>) #22 {
-+define internal <1 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb1_tS_(<1 x i16>, <1 x i16>) #22 {
-   %3 = alloca <1 x i16>, align 2
-   %4 = alloca <1 x i16>, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -3294,7 +3294,7 @@ define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb1_tS_(<1 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb2_tS_(<2 x i16>, <2 x i16>) #14 {
-+define internal <2 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb2_tS_(<2 x i16>, <2 x i16>) #14 {
-   %3 = alloca <2 x i16>, align 4
-   %4 = alloca <2 x i16>, align 4
-   %5 = alloca <2 x i16>, align 4
-@@ -3360,7 +3360,7 @@ define internal <2 x i16> @_ZN7details14__impl_udivremILi2EEEu2CMvbT__tS1_S1_u2C
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb4_tS_(<4 x i16>, <4 x i16>) #15 {
-+define internal <4 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb4_tS_(<4 x i16>, <4 x i16>) #15 {
-   %3 = alloca <4 x i16>, align 8
-   %4 = alloca <4 x i16>, align 8
-   %5 = alloca <4 x i16>, align 8
-@@ -3558,7 +3558,7 @@ define internal <16 x i16> @_ZN7details14__impl_udivremILi16EEEu2CMvbT__tS1_S1_u
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb32_tS_(<32 x i16>, <32 x i16>) #18 {
-+define internal <32 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb32_tS_(<32 x i16>, <32 x i16>) #18 {
-   %3 = alloca <32 x i16>, align 64
-   %4 = alloca <32 x i16>, align 64
-   %5 = alloca <32 x i16>, align 64
-@@ -3624,7 +3624,7 @@ define internal <32 x i16> @_ZN7details14__impl_udivremILi32EEEu2CMvbT__tS1_S1_u
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local zeroext i16 @_Z24__cm_intrinsic_impl_uremtt(i16 zeroext, i16 zeroext) #22 {
-+define internal zeroext i16 @_Z24__cm_intrinsic_impl_uremtt(i16 zeroext, i16 zeroext) #22 {
-   %3 = alloca i16, align 2
-   %4 = alloca i16, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -3650,7 +3650,7 @@ define dso_local zeroext i16 @_Z24__cm_intrinsic_impl_uremtt(i16 zeroext, i16 ze
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb1_tS_(<1 x i16>, <1 x i16>) #22 {
-+define internal <1 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb1_tS_(<1 x i16>, <1 x i16>) #22 {
-   %3 = alloca <1 x i16>, align 2
-   %4 = alloca <1 x i16>, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -3664,7 +3664,7 @@ define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb1_tS_(<1 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb2_tS_(<2 x i16>, <2 x i16>) #14 {
-+define internal <2 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb2_tS_(<2 x i16>, <2 x i16>) #14 {
-   %3 = alloca <2 x i16>, align 4
-   %4 = alloca <2 x i16>, align 4
-   %5 = alloca <2 x i16>, align 4
-@@ -3678,7 +3678,7 @@ define dso_local <2 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb2_tS_(<2 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb4_tS_(<4 x i16>, <4 x i16>) #15 {
-+define internal <4 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb4_tS_(<4 x i16>, <4 x i16>) #15 {
-   %3 = alloca <4 x i16>, align 8
-   %4 = alloca <4 x i16>, align 8
-   %5 = alloca <4 x i16>, align 8
-@@ -3692,7 +3692,7 @@ define dso_local <4 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb4_tS_(<4 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <8 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb8_tS_(<8 x i16>, <8 x i16>) #16 {
-+define internal <8 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb8_tS_(<8 x i16>, <8 x i16>) #16 {
-   %3 = alloca <8 x i16>, align 16
-   %4 = alloca <8 x i16>, align 16
-   %5 = alloca <8 x i16>, align 16
-@@ -3706,7 +3706,7 @@ define dso_local <8 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb8_tS_(<8 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <16 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb16_tS_(<16 x i16>, <16 x i16>) #17 {
-+define internal <16 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb16_tS_(<16 x i16>, <16 x i16>) #17 {
-   %3 = alloca <16 x i16>, align 32
-   %4 = alloca <16 x i16>, align 32
-   %5 = alloca <16 x i16>, align 32
-@@ -3720,7 +3720,7 @@ define dso_local <16 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb16_tS_(<16 x i16>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb32_tS_(<32 x i16>, <32 x i16>) #18 {
-+define internal <32 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb32_tS_(<32 x i16>, <32 x i16>) #18 {
-   %3 = alloca <32 x i16>, align 64
-   %4 = alloca <32 x i16>, align 64
-   %5 = alloca <32 x i16>, align 64
-@@ -3734,7 +3734,7 @@ define dso_local <32 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb32_tS_(<32 x i16>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local i32 @_Z24__cm_intrinsic_impl_udivjj(i32, i32) #14 {
-+define internal i32 @_Z24__cm_intrinsic_impl_udivjj(i32, i32) #14 {
-   %3 = alloca i32, align 4
-   %4 = alloca i32, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -3892,7 +3892,7 @@ define internal <1 x i32> @_ZN7details14__impl_udivremILi1EEEu2CMvbT__jS1_S1_u2C
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb1_jS_(<1 x i32>, <1 x i32>) #14 {
-+define internal <1 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb1_jS_(<1 x i32>, <1 x i32>) #14 {
-   %3 = alloca <1 x i32>, align 4
-   %4 = alloca <1 x i32>, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -3908,7 +3908,7 @@ define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb1_jS_(<1 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb2_jS_(<2 x i32>, <2 x i32>) #15 {
-+define internal <2 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb2_jS_(<2 x i32>, <2 x i32>) #15 {
-   %3 = alloca <2 x i32>, align 8
-   %4 = alloca <2 x i32>, align 8
-   %5 = alloca <2 x i32>, align 8
-@@ -4054,7 +4054,7 @@ define internal <2 x i32> @_ZN7details14__impl_udivremILi2EEEu2CMvbT__jS1_S1_u2C
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb4_jS_(<4 x i32>, <4 x i32>) #16 {
-+define internal <4 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb4_jS_(<4 x i32>, <4 x i32>) #16 {
-   %3 = alloca <4 x i32>, align 16
-   %4 = alloca <4 x i32>, align 16
-   %5 = alloca <4 x i32>, align 16
-@@ -4492,7 +4492,7 @@ define internal <16 x i32> @_ZN7details14__impl_udivremILi16EEEu2CMvbT__jS1_S1_u
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb32_jS_(<32 x i32>, <32 x i32>) #19 {
-+define internal <32 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb32_jS_(<32 x i32>, <32 x i32>) #19 {
-   %3 = alloca <32 x i32>, align 128
-   %4 = alloca <32 x i32>, align 128
-   %5 = alloca <32 x i32>, align 128
-@@ -4638,7 +4638,7 @@ define internal <32 x i32> @_ZN7details14__impl_udivremILi32EEEu2CMvbT__jS1_S1_u
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local i32 @_Z24__cm_intrinsic_impl_uremjj(i32, i32) #14 {
-+define internal i32 @_Z24__cm_intrinsic_impl_uremjj(i32, i32) #14 {
-   %3 = alloca i32, align 4
-   %4 = alloca i32, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -4664,7 +4664,7 @@ define dso_local i32 @_Z24__cm_intrinsic_impl_uremjj(i32, i32) #14 {
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb1_jS_(<1 x i32>, <1 x i32>) #14 {
-+define internal <1 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb1_jS_(<1 x i32>, <1 x i32>) #14 {
-   %3 = alloca <1 x i32>, align 4
-   %4 = alloca <1 x i32>, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -4678,7 +4678,7 @@ define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb1_jS_(<1 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb2_jS_(<2 x i32>, <2 x i32>) #15 {
-+define internal <2 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb2_jS_(<2 x i32>, <2 x i32>) #15 {
-   %3 = alloca <2 x i32>, align 8
-   %4 = alloca <2 x i32>, align 8
-   %5 = alloca <2 x i32>, align 8
-@@ -4692,7 +4692,7 @@ define dso_local <2 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb2_jS_(<2 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb4_jS_(<4 x i32>, <4 x i32>) #16 {
-+define internal <4 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb4_jS_(<4 x i32>, <4 x i32>) #16 {
-   %3 = alloca <4 x i32>, align 16
-   %4 = alloca <4 x i32>, align 16
-   %5 = alloca <4 x i32>, align 16
-@@ -4706,7 +4706,7 @@ define dso_local <4 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb4_jS_(<4 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <8 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb8_jS_(<8 x i32>, <8 x i32>) #17 {
-+define internal <8 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb8_jS_(<8 x i32>, <8 x i32>) #17 {
-   %3 = alloca <8 x i32>, align 32
-   %4 = alloca <8 x i32>, align 32
-   %5 = alloca <8 x i32>, align 32
-@@ -4720,7 +4720,7 @@ define dso_local <8 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb8_jS_(<8 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <16 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb16_jS_(<16 x i32>, <16 x i32>) #18 {
-+define internal <16 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb16_jS_(<16 x i32>, <16 x i32>) #18 {
-   %3 = alloca <16 x i32>, align 64
-   %4 = alloca <16 x i32>, align 64
-   %5 = alloca <16 x i32>, align 64
-@@ -4734,7 +4734,7 @@ define dso_local <16 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb16_jS_(<16 x i32>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb32_jS_(<32 x i32>, <32 x i32>) #19 {
-+define internal <32 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb32_jS_(<32 x i32>, <32 x i32>) #19 {
-   %3 = alloca <32 x i32>, align 128
-   %4 = alloca <32 x i32>, align 128
-   %5 = alloca <32 x i32>, align 128
-@@ -4748,7 +4748,7 @@ define dso_local <32 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb32_jS_(<32 x i32>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local void @__do_print_cm(i8*, i8*, i32, i64, i32*, i32, i32) #23 !dbg !15 {
-+define internal void @__do_print_cm(i8*, i8*, i32, i64, i32*, i32, i32) #23 !dbg !15 {
-   %8 = alloca i8*, align 4
-   %9 = alloca i8*, align 4
-   %10 = alloca i32, align 4
-@@ -4988,7 +4988,7 @@ define internal void @_ZN7details16_cm_print_formatILi128EEEv15cm_surfaceindexju
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local void @__do_print_lz(i32, i8*, i32, i64, i32*, i32, i32, i32, i32) #26 !dbg !117 {
-+define internal void @__do_print_lz(i32, i8*, i32, i64, i32*, i32, i32, i32, i32) #26 !dbg !117 {
-   %10 = alloca i32, align 4
-   %11 = alloca i8*, align 4
-   %12 = alloca i32, align 4
-@@ -5069,7 +5069,7 @@ define dso_local void @__do_print_lz(i32, i8*, i32, i64, i32*, i32, i32, i32, i3
-   %67 = load i64, i64* %13, align 8, !dbg !159, !tbaa !19
-   %68 = load <5 x i32>, <5 x i32>* %21, align 32, !dbg !160, !tbaa !7
-   call void @_ZN13VaryingWriterC2ERjRPKjiyu2CMvb5_i(%class.VaryingWriter* %23, i32* dereferenceable(4) %19, i32** dereferenceable(4) %14, i32 %66, i64 %67, <5 x i32> %68), !dbg !161
--  %69 = call zeroext i1 @_ZN9PrintInfo14switchEncodingI13UniformWriter13VaryingWriterEEbNS_8EncodingET_T0_(i8 signext %62, %class.UniformWriter* byval align 32 %22, %class.VaryingWriter* byval align 32 %23), !dbg !162
-+  %69 = call zeroext i1 @_ZN9PrintInfo14switchEncodingI13UniformWriter13VaryingWriterEEbNS_8EncodingET_T0_(i8 signext %62, %class.UniformWriter* byval(%class.UniformWriter) align 32 %22, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %23), !dbg !162
-   br label %70, !dbg !163
- 
- ; <label>:70:                                     ; preds = %60
-@@ -5187,7 +5187,7 @@ define internal <5 x i32> @_Z17get_auxiliary_strv() #28 comdat !dbg !178 {
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo14switchEncodingI13UniformWriter13VaryingWriterEEbNS_8EncodingET_T0_(i8 signext, %class.UniformWriter* byval align 32, %class.VaryingWriter* byval align 32) #25 comdat !dbg !191 {
-+define internal zeroext i1 @_ZN9PrintInfo14switchEncodingI13UniformWriter13VaryingWriterEEbNS_8EncodingET_T0_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %class.VaryingWriter* byval(%class.VaryingWriter) align 32) #25 comdat !dbg !191 {
-   %4 = alloca i8, align 1
-   %5 = alloca %class.UniformWriter, align 32
-   %6 = alloca %class.VaryingWriter, align 32
-@@ -5196,7 +5196,7 @@ define internal zeroext i1 @_ZN9PrintInfo14switchEncodingI13UniformWriter13Varyi
-   %8 = bitcast %class.UniformWriter* %5 to i8*, !dbg !196
-   %9 = bitcast %class.UniformWriter* %1 to i8*, !dbg !196
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %8, i8* align 32 %9, i32 64, i1 false), !dbg !196, !tbaa.struct !197
--  %10 = call zeroext i1 @_ZN9PrintInfo22switchEncoding4UniformI13UniformWriterEEbNS_8EncodingET_(i8 signext %7, %class.UniformWriter* byval align 32 %5), !dbg !198
-+  %10 = call zeroext i1 @_ZN9PrintInfo22switchEncoding4UniformI13UniformWriterEEbNS_8EncodingET_(i8 signext %7, %class.UniformWriter* byval(%class.UniformWriter) align 32 %5), !dbg !198
-   br i1 %10, label %16, label %11, !dbg !199
- 
- ; <label>:11:                                     ; preds = %3
-@@ -5204,7 +5204,7 @@ define internal zeroext i1 @_ZN9PrintInfo14switchEncodingI13UniformWriter13Varyi
-   %13 = bitcast %class.VaryingWriter* %6 to i8*, !dbg !201
-   %14 = bitcast %class.VaryingWriter* %2 to i8*, !dbg !201
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %13, i8* align 32 %14, i32 64, i1 false), !dbg !201, !tbaa.struct !197
--  %15 = call zeroext i1 @_ZN9PrintInfo22switchEncoding4VaryingI13VaryingWriterEEbNS_8EncodingET_(i8 signext %12, %class.VaryingWriter* byval align 32 %6), !dbg !202
-+  %15 = call zeroext i1 @_ZN9PrintInfo22switchEncoding4VaryingI13VaryingWriterEEbNS_8EncodingET_(i8 signext %12, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %6), !dbg !202
-   br label %16, !dbg !199
- 
- ; <label>:16:                                     ; preds = %11, %3
-@@ -5279,7 +5279,7 @@ define internal void @_ZN13VaryingWriterC2ERjRPKjiyu2CMvb5_i(%class.VaryingWrite
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local i32 @__num_cores() #29 !dbg !236 {
-+define internal i32 @__num_cores() #29 !dbg !236 {
-   ret i32 -1, !dbg !237
- }
- 
-@@ -8860,7 +8860,7 @@ declare dso_local void @_ZN7details37__cm_intrinsic_impl_svm_scatter_writeIiLi1E
- declare void @llvm.genx.svm.scatter.v1i1.v1i64.v1i32(<1 x i1>, i32, <1 x i64>, <1 x i32>) #27
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4UniformI13UniformWriterEEbNS_8EncodingET_(i8 signext, %class.UniformWriter* byval align 32) #25 comdat !dbg !1645 {
-+define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4UniformI13UniformWriterEEbNS_8EncodingET_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32) #25 comdat !dbg !1645 {
-   %3 = alloca i8, align 1
-   %4 = alloca %class.UniformWriter, align 32
-   %5 = alloca %"struct.PrintInfo::Encoding4Uniform", align 1
-@@ -8869,7 +8869,7 @@ define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4UniformI13UniformWrite
-   %7 = bitcast %class.UniformWriter* %4 to i8*, !dbg !1647
-   %8 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1647
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %7, i8* align 32 %8, i32 64, i1 false), !dbg !1647, !tbaa.struct !197
--  %9 = call zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET_T0_(i8 signext %6, %class.UniformWriter* byval align 32 %4, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %5), !dbg !1648
-+  %9 = call zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET_T0_(i8 signext %6, %class.UniformWriter* byval(%class.UniformWriter) align 32 %4, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %5), !dbg !1648
-   ret i1 %9, !dbg !1649
- }
- 
-@@ -8877,7 +8877,7 @@ define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4UniformI13UniformWrite
- declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i1) #32
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4VaryingI13VaryingWriterEEbNS_8EncodingET_(i8 signext, %class.VaryingWriter* byval align 32) #25 comdat !dbg !1650 {
-+define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4VaryingI13VaryingWriterEEbNS_8EncodingET_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32) #25 comdat !dbg !1650 {
-   %3 = alloca i8, align 1
-   %4 = alloca %class.VaryingWriter, align 32
-   %5 = alloca %"struct.PrintInfo::Encoding4Varying", align 1
-@@ -8886,12 +8886,12 @@ define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4VaryingI13VaryingWrite
-   %7 = bitcast %class.VaryingWriter* %4 to i8*, !dbg !1652
-   %8 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !1652
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %7, i8* align 32 %8, i32 64, i1 false), !dbg !1652, !tbaa.struct !197
--  %9 = call zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET_T0_(i8 signext %6, %class.VaryingWriter* byval align 32 %4, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %5), !dbg !1653
-+  %9 = call zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET_T0_(i8 signext %6, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %4, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %5), !dbg !1653
-   ret i1 %9, !dbg !1654
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET_T0_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1655 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET_T0_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1655 {
-   %4 = alloca i8, align 1
-   %5 = alloca %class.UniformWriter, align 32
-   %6 = alloca %"struct.PrintInfo::Encoding4Uniform", align 1
-@@ -8914,7 +8914,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %22 = bitcast %class.UniformWriter* %5 to i8*, !dbg !1657
-   %23 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1657
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %22, i8* align 32 %23, i32 64, i1 false), !dbg !1657, !tbaa.struct !197
--  %24 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %21, %class.UniformWriter* byval align 32 %5, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %6), !dbg !1658
-+  %24 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %21, %class.UniformWriter* byval(%class.UniformWriter) align 32 %5, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %6), !dbg !1658
-   br i1 %24, label %60, label %25, !dbg !1659
- 
- ; <label>:25:                                     ; preds = %3
-@@ -8922,7 +8922,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %27 = bitcast %class.UniformWriter* %7 to i8*, !dbg !1661
-   %28 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1661
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %27, i8* align 32 %28, i32 64, i1 false), !dbg !1661, !tbaa.struct !197
--  %29 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %26, %class.UniformWriter* byval align 32 %7, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %8), !dbg !1662
-+  %29 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %26, %class.UniformWriter* byval(%class.UniformWriter) align 32 %7, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %8), !dbg !1662
-   br i1 %29, label %60, label %30, !dbg !1663
- 
- ; <label>:30:                                     ; preds = %25
-@@ -8930,7 +8930,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %32 = bitcast %class.UniformWriter* %9 to i8*, !dbg !1665
-   %33 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1665
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %32, i8* align 32 %33, i32 64, i1 false), !dbg !1665, !tbaa.struct !197
--  %34 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %31, %class.UniformWriter* byval align 32 %9, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %10), !dbg !1666
-+  %34 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %31, %class.UniformWriter* byval(%class.UniformWriter) align 32 %9, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %10), !dbg !1666
-   br i1 %34, label %60, label %35, !dbg !1667
- 
- ; <label>:35:                                     ; preds = %30
-@@ -8938,7 +8938,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %37 = bitcast %class.UniformWriter* %11 to i8*, !dbg !1669
-   %38 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1669
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %37, i8* align 32 %38, i32 64, i1 false), !dbg !1669, !tbaa.struct !197
--  %39 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %36, %class.UniformWriter* byval align 32 %11, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %12), !dbg !1670
-+  %39 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %36, %class.UniformWriter* byval(%class.UniformWriter) align 32 %11, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %12), !dbg !1670
-   br i1 %39, label %60, label %40, !dbg !1671
- 
- ; <label>:40:                                     ; preds = %35
-@@ -8946,7 +8946,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %42 = bitcast %class.UniformWriter* %13 to i8*, !dbg !1673
-   %43 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1673
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %42, i8* align 32 %43, i32 64, i1 false), !dbg !1673, !tbaa.struct !197
--  %44 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %41, %class.UniformWriter* byval align 32 %13, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %14), !dbg !1674
-+  %44 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %41, %class.UniformWriter* byval(%class.UniformWriter) align 32 %13, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %14), !dbg !1674
-   br i1 %44, label %60, label %45, !dbg !1675
- 
- ; <label>:45:                                     ; preds = %40
-@@ -8954,7 +8954,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %47 = bitcast %class.UniformWriter* %15 to i8*, !dbg !1677
-   %48 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1677
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %47, i8* align 32 %48, i32 64, i1 false), !dbg !1677, !tbaa.struct !197
--  %49 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %46, %class.UniformWriter* byval align 32 %15, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %16), !dbg !1678
-+  %49 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %46, %class.UniformWriter* byval(%class.UniformWriter) align 32 %15, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %16), !dbg !1678
-   br i1 %49, label %60, label %50, !dbg !1679
- 
- ; <label>:50:                                     ; preds = %45
-@@ -8962,7 +8962,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %52 = bitcast %class.UniformWriter* %17 to i8*, !dbg !1681
-   %53 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1681
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %52, i8* align 32 %53, i32 64, i1 false), !dbg !1681, !tbaa.struct !197
--  %54 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %51, %class.UniformWriter* byval align 32 %17, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %18), !dbg !1682
-+  %54 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %51, %class.UniformWriter* byval(%class.UniformWriter) align 32 %17, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %18), !dbg !1682
-   br i1 %54, label %60, label %55, !dbg !1683
- 
- ; <label>:55:                                     ; preds = %50
-@@ -8970,7 +8970,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %57 = bitcast %class.UniformWriter* %19 to i8*, !dbg !1685
-   %58 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1685
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %57, i8* align 32 %58, i32 64, i1 false), !dbg !1685, !tbaa.struct !197
--  %59 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %56, %class.UniformWriter* byval align 32 %19, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %20), !dbg !1686
-+  %59 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %56, %class.UniformWriter* byval(%class.UniformWriter) align 32 %19, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %20), !dbg !1686
-   br label %60, !dbg !1683
- 
- ; <label>:60:                                     ; preds = %55, %50, %45, %40, %35, %30, %25, %3
-@@ -8979,7 +8979,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1688 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1688 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9005,7 +9005,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1697 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1697 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9031,7 +9031,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1706 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1706 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9057,7 +9057,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1715 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1715 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9083,7 +9083,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1724 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1724 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9109,7 +9109,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1733 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1733 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9135,7 +9135,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1742 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1742 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9161,7 +9161,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1751 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1751 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9984,7 +9984,7 @@ define internal i32 @_ZN7details18_cm_print_type_oclIPvEENS_18SHADER_PRINTF_TYPE
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET_T0_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2055 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET_T0_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2055 {
-   %4 = alloca i8, align 1
-   %5 = alloca %class.VaryingWriter, align 32
-   %6 = alloca %"struct.PrintInfo::Encoding4Varying", align 1
-@@ -10007,7 +10007,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %22 = bitcast %class.VaryingWriter* %5 to i8*, !dbg !2057
-   %23 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2057
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %22, i8* align 32 %23, i32 64, i1 false), !dbg !2057, !tbaa.struct !197
--  %24 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %21, %class.VaryingWriter* byval align 32 %5, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %6), !dbg !2058
-+  %24 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %21, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %5, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %6), !dbg !2058
-   br i1 %24, label %60, label %25, !dbg !2059
- 
- ; <label>:25:                                     ; preds = %3
-@@ -10015,7 +10015,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %27 = bitcast %class.VaryingWriter* %7 to i8*, !dbg !2061
-   %28 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2061
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %27, i8* align 32 %28, i32 64, i1 false), !dbg !2061, !tbaa.struct !197
--  %29 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %26, %class.VaryingWriter* byval align 32 %7, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %8), !dbg !2062
-+  %29 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %26, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %7, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %8), !dbg !2062
-   br i1 %29, label %60, label %30, !dbg !2063
- 
- ; <label>:30:                                     ; preds = %25
-@@ -10023,7 +10023,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %32 = bitcast %class.VaryingWriter* %9 to i8*, !dbg !2065
-   %33 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2065
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %32, i8* align 32 %33, i32 64, i1 false), !dbg !2065, !tbaa.struct !197
--  %34 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %31, %class.VaryingWriter* byval align 32 %9, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %10), !dbg !2066
-+  %34 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %31, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %9, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %10), !dbg !2066
-   br i1 %34, label %60, label %35, !dbg !2067
- 
- ; <label>:35:                                     ; preds = %30
-@@ -10031,7 +10031,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %37 = bitcast %class.VaryingWriter* %11 to i8*, !dbg !2069
-   %38 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2069
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %37, i8* align 32 %38, i32 64, i1 false), !dbg !2069, !tbaa.struct !197
--  %39 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %36, %class.VaryingWriter* byval align 32 %11, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %12), !dbg !2070
-+  %39 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %36, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %11, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %12), !dbg !2070
-   br i1 %39, label %60, label %40, !dbg !2071
- 
- ; <label>:40:                                     ; preds = %35
-@@ -10039,7 +10039,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %42 = bitcast %class.VaryingWriter* %13 to i8*, !dbg !2073
-   %43 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2073
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %42, i8* align 32 %43, i32 64, i1 false), !dbg !2073, !tbaa.struct !197
--  %44 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %41, %class.VaryingWriter* byval align 32 %13, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %14), !dbg !2074
-+  %44 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %41, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %13, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %14), !dbg !2074
-   br i1 %44, label %60, label %45, !dbg !2075
- 
- ; <label>:45:                                     ; preds = %40
-@@ -10047,7 +10047,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %47 = bitcast %class.VaryingWriter* %15 to i8*, !dbg !2077
-   %48 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2077
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %47, i8* align 32 %48, i32 64, i1 false), !dbg !2077, !tbaa.struct !197
--  %49 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %46, %class.VaryingWriter* byval align 32 %15, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %16), !dbg !2078
-+  %49 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %46, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %15, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %16), !dbg !2078
-   br i1 %49, label %60, label %50, !dbg !2079
- 
- ; <label>:50:                                     ; preds = %45
-@@ -10055,7 +10055,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %52 = bitcast %class.VaryingWriter* %17 to i8*, !dbg !2081
-   %53 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2081
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %52, i8* align 32 %53, i32 64, i1 false), !dbg !2081, !tbaa.struct !197
--  %54 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %51, %class.VaryingWriter* byval align 32 %17, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %18), !dbg !2082
-+  %54 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %51, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %17, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %18), !dbg !2082
-   br i1 %54, label %60, label %55, !dbg !2083
- 
- ; <label>:55:                                     ; preds = %50
-@@ -10063,7 +10063,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %57 = bitcast %class.VaryingWriter* %19 to i8*, !dbg !2085
-   %58 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2085
-   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 32 %57, i8* align 32 %58, i32 64, i1 false), !dbg !2085, !tbaa.struct !197
--  %59 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %56, %class.VaryingWriter* byval align 32 %19, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %20), !dbg !2086
-+  %59 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %56, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %19, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %20), !dbg !2086
-   br label %60, !dbg !2083
- 
- ; <label>:60:                                     ; preds = %55, %50, %45, %40, %35, %30, %25, %3
-@@ -10072,7 +10072,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2088 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2088 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10098,7 +10098,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2097 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2097 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10124,7 +10124,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2106 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2106 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10150,7 +10150,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2115 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2115 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10176,7 +10176,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2124 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2124 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10202,7 +10202,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2133 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2133 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10228,7 +10228,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2142 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2142 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10254,7 +10254,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2151 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2151 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-diff --git a/builtins/builtins-cm-64.ll b/builtins/builtins-cm-64.ll
-index 39a2dd8be..375d01bed 100644
---- a/builtins/builtins-cm-64.ll
-+++ b/builtins/builtins-cm-64.ll
-@@ -557,7 +557,7 @@ $_ZN13VaryingWriter12WriteVecElemIPvEEvv = comdat any
- @.str.10 = private unnamed_addr constant [8 x i8] c"%016llX\00", align 1
- 
- ; Function Attrs: noinline nounwind
--define dso_local signext i8 @_Z24__cm_intrinsic_impl_sdivcc(i8 signext, i8 signext) #0 {
-+define internal signext i8 @_Z24__cm_intrinsic_impl_sdivcc(i8 signext, i8 signext) #0 {
-   %3 = alloca i8, align 1
-   %4 = alloca i8, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -618,7 +618,7 @@ define internal <1 x i8> @_ZN7details13__impl_divremILi1EEEu2CMvbT__cS1_S1_u2CMv
- declare <1 x i8> @llvm.genx.rdregioni.v1i8.v1i8.i16(<1 x i8>, i32, i32, i32, i16, i32) #2
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_cS_(<1 x i8>, <1 x i8>) #0 {
-+define internal <1 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_cS_(<1 x i8>, <1 x i8>) #0 {
-   %3 = alloca <1 x i8>, align 1
-   %4 = alloca <1 x i8>, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -634,7 +634,7 @@ define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_cS_(<1 x i8>, <1
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb2_cS_(<2 x i8>, <2 x i8>) #3 {
-+define internal <2 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb2_cS_(<2 x i8>, <2 x i8>) #3 {
-   %3 = alloca <2 x i8>, align 2
-   %4 = alloca <2 x i8>, align 2
-   %5 = alloca <2 x i8>, align 2
-@@ -680,7 +680,7 @@ define internal <2 x i8> @_ZN7details13__impl_divremILi2EEEu2CMvbT__cS1_S1_u2CMv
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb4_cS_(<4 x i8>, <4 x i8>) #5 {
-+define internal <4 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb4_cS_(<4 x i8>, <4 x i8>) #5 {
-   %3 = alloca <4 x i8>, align 4
-   %4 = alloca <4 x i8>, align 4
-   %5 = alloca <4 x i8>, align 4
-@@ -818,7 +818,7 @@ define internal <16 x i8> @_ZN7details13__impl_divremILi16EEEu2CMvbT__cS1_S1_u2C
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb32_cS_(<32 x i8>, <32 x i8>) #11 {
-+define internal <32 x i8> @_Z24__cm_intrinsic_impl_sdivu2CMvb32_cS_(<32 x i8>, <32 x i8>) #11 {
-   %3 = alloca <32 x i8>, align 32
-   %4 = alloca <32 x i8>, align 32
-   %5 = alloca <32 x i8>, align 32
-@@ -864,7 +864,7 @@ define internal <32 x i8> @_ZN7details13__impl_divremILi32EEEu2CMvbT__cS1_S1_u2C
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local signext i8 @_Z24__cm_intrinsic_impl_sremcc(i8 signext, i8 signext) #0 {
-+define internal signext i8 @_Z24__cm_intrinsic_impl_sremcc(i8 signext, i8 signext) #0 {
-   %3 = alloca i8, align 1
-   %4 = alloca i8, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -890,7 +890,7 @@ define dso_local signext i8 @_Z24__cm_intrinsic_impl_sremcc(i8 signext, i8 signe
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb1_cS_(<1 x i8>, <1 x i8>) #0 {
-+define internal <1 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb1_cS_(<1 x i8>, <1 x i8>) #0 {
-   %3 = alloca <1 x i8>, align 1
-   %4 = alloca <1 x i8>, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -904,7 +904,7 @@ define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb1_cS_(<1 x i8>, <1
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb2_cS_(<2 x i8>, <2 x i8>) #3 {
-+define internal <2 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb2_cS_(<2 x i8>, <2 x i8>) #3 {
-   %3 = alloca <2 x i8>, align 2
-   %4 = alloca <2 x i8>, align 2
-   %5 = alloca <2 x i8>, align 2
-@@ -918,7 +918,7 @@ define dso_local <2 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb2_cS_(<2 x i8>, <2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb4_cS_(<4 x i8>, <4 x i8>) #5 {
-+define internal <4 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb4_cS_(<4 x i8>, <4 x i8>) #5 {
-   %3 = alloca <4 x i8>, align 4
-   %4 = alloca <4 x i8>, align 4
-   %5 = alloca <4 x i8>, align 4
-@@ -932,7 +932,7 @@ define dso_local <4 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb4_cS_(<4 x i8>, <4
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <8 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb8_cS_(<8 x i8>, <8 x i8>) #7 {
-+define internal <8 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb8_cS_(<8 x i8>, <8 x i8>) #7 {
-   %3 = alloca <8 x i8>, align 8
-   %4 = alloca <8 x i8>, align 8
-   %5 = alloca <8 x i8>, align 8
-@@ -946,7 +946,7 @@ define dso_local <8 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb8_cS_(<8 x i8>, <8
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <16 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb16_cS_(<16 x i8>, <16 x i8>) #9 {
-+define internal <16 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb16_cS_(<16 x i8>, <16 x i8>) #9 {
-   %3 = alloca <16 x i8>, align 16
-   %4 = alloca <16 x i8>, align 16
-   %5 = alloca <16 x i8>, align 16
-@@ -960,7 +960,7 @@ define dso_local <16 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb16_cS_(<16 x i8>,
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb32_cS_(<32 x i8>, <32 x i8>) #11 {
-+define internal <32 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb32_cS_(<32 x i8>, <32 x i8>) #11 {
-   %3 = alloca <32 x i8>, align 32
-   %4 = alloca <32 x i8>, align 32
-   %5 = alloca <32 x i8>, align 32
-@@ -974,7 +974,7 @@ define dso_local <32 x i8> @_Z24__cm_intrinsic_impl_sremu2CMvb32_cS_(<32 x i8>,
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local signext i16 @_Z24__cm_intrinsic_impl_sdivss(i16 signext, i16 signext) #3 {
-+define internal signext i16 @_Z24__cm_intrinsic_impl_sdivss(i16 signext, i16 signext) #3 {
-   %3 = alloca i16, align 2
-   %4 = alloca i16, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -1058,7 +1058,7 @@ define internal <1 x i16> @_ZN7details13__impl_divremILi1EEEu2CMvbT__sS1_S1_u2CM
- declare <1 x i16> @llvm.genx.rdregioni.v1i16.v1i16.i16(<1 x i16>, i32, i32, i32, i16, i32) #2
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_sS_(<1 x i16>, <1 x i16>) #3 {
-+define internal <1 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_sS_(<1 x i16>, <1 x i16>) #3 {
-   %3 = alloca <1 x i16>, align 2
-   %4 = alloca <1 x i16>, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -1074,7 +1074,7 @@ define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_sS_(<1 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb2_sS_(<2 x i16>, <2 x i16>) #5 {
-+define internal <2 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb2_sS_(<2 x i16>, <2 x i16>) #5 {
-   %3 = alloca <2 x i16>, align 4
-   %4 = alloca <2 x i16>, align 4
-   %5 = alloca <2 x i16>, align 4
-@@ -1143,7 +1143,7 @@ define internal <2 x i16> @_ZN7details13__impl_divremILi2EEEu2CMvbT__sS1_S1_u2CM
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb4_sS_(<4 x i16>, <4 x i16>) #7 {
-+define internal <4 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb4_sS_(<4 x i16>, <4 x i16>) #7 {
-   %3 = alloca <4 x i16>, align 8
-   %4 = alloca <4 x i16>, align 8
-   %5 = alloca <4 x i16>, align 8
-@@ -1350,7 +1350,7 @@ define internal <16 x i16> @_ZN7details13__impl_divremILi16EEEu2CMvbT__sS1_S1_u2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb32_sS_(<32 x i16>, <32 x i16>) #13 {
-+define internal <32 x i16> @_Z24__cm_intrinsic_impl_sdivu2CMvb32_sS_(<32 x i16>, <32 x i16>) #13 {
-   %3 = alloca <32 x i16>, align 64
-   %4 = alloca <32 x i16>, align 64
-   %5 = alloca <32 x i16>, align 64
-@@ -1419,7 +1419,7 @@ define internal <32 x i16> @_ZN7details13__impl_divremILi32EEEu2CMvbT__sS1_S1_u2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local signext i16 @_Z24__cm_intrinsic_impl_sremss(i16 signext, i16 signext) #3 {
-+define internal signext i16 @_Z24__cm_intrinsic_impl_sremss(i16 signext, i16 signext) #3 {
-   %3 = alloca i16, align 2
-   %4 = alloca i16, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -1445,7 +1445,7 @@ define dso_local signext i16 @_Z24__cm_intrinsic_impl_sremss(i16 signext, i16 si
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb1_sS_(<1 x i16>, <1 x i16>) #3 {
-+define internal <1 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb1_sS_(<1 x i16>, <1 x i16>) #3 {
-   %3 = alloca <1 x i16>, align 2
-   %4 = alloca <1 x i16>, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -1459,7 +1459,7 @@ define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb1_sS_(<1 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb2_sS_(<2 x i16>, <2 x i16>) #5 {
-+define internal <2 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb2_sS_(<2 x i16>, <2 x i16>) #5 {
-   %3 = alloca <2 x i16>, align 4
-   %4 = alloca <2 x i16>, align 4
-   %5 = alloca <2 x i16>, align 4
-@@ -1473,7 +1473,7 @@ define dso_local <2 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb2_sS_(<2 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb4_sS_(<4 x i16>, <4 x i16>) #7 {
-+define internal <4 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb4_sS_(<4 x i16>, <4 x i16>) #7 {
-   %3 = alloca <4 x i16>, align 8
-   %4 = alloca <4 x i16>, align 8
-   %5 = alloca <4 x i16>, align 8
-@@ -1487,7 +1487,7 @@ define dso_local <4 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb4_sS_(<4 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <8 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb8_sS_(<8 x i16>, <8 x i16>) #9 {
-+define internal <8 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb8_sS_(<8 x i16>, <8 x i16>) #9 {
-   %3 = alloca <8 x i16>, align 16
-   %4 = alloca <8 x i16>, align 16
-   %5 = alloca <8 x i16>, align 16
-@@ -1501,7 +1501,7 @@ define dso_local <8 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb8_sS_(<8 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <16 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb16_sS_(<16 x i16>, <16 x i16>) #11 {
-+define internal <16 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb16_sS_(<16 x i16>, <16 x i16>) #11 {
-   %3 = alloca <16 x i16>, align 32
-   %4 = alloca <16 x i16>, align 32
-   %5 = alloca <16 x i16>, align 32
-@@ -1515,7 +1515,7 @@ define dso_local <16 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb16_sS_(<16 x i16>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb32_sS_(<32 x i16>, <32 x i16>) #13 {
-+define internal <32 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb32_sS_(<32 x i16>, <32 x i16>) #13 {
-   %3 = alloca <32 x i16>, align 64
-   %4 = alloca <32 x i16>, align 64
-   %5 = alloca <32 x i16>, align 64
-@@ -1529,7 +1529,7 @@ define dso_local <32 x i16> @_Z24__cm_intrinsic_impl_sremu2CMvb32_sS_(<32 x i16>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local i32 @_Z24__cm_intrinsic_impl_sdivii(i32, i32) #14 {
-+define internal i32 @_Z24__cm_intrinsic_impl_sdivii(i32, i32) #14 {
-   %3 = alloca i32, align 4
-   %4 = alloca i32, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -1730,7 +1730,7 @@ define internal <1 x i32> @_ZN7details13__impl_divremILi1EEEu2CMvbT__iS1_S1_u2CM
- declare <1 x i32> @llvm.genx.rdregioni.v1i32.v1i32.i16(<1 x i32>, i32, i32, i32, i16, i32) #2
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_iS_(<1 x i32>, <1 x i32>) #14 {
-+define internal <1 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_iS_(<1 x i32>, <1 x i32>) #14 {
-   %3 = alloca <1 x i32>, align 4
-   %4 = alloca <1 x i32>, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -1746,7 +1746,7 @@ define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb1_iS_(<1 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb2_iS_(<2 x i32>, <2 x i32>) #15 {
-+define internal <2 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb2_iS_(<2 x i32>, <2 x i32>) #15 {
-   %3 = alloca <2 x i32>, align 8
-   %4 = alloca <2 x i32>, align 8
-   %5 = alloca <2 x i32>, align 8
-@@ -1932,7 +1932,7 @@ define internal <2 x i32> @_ZN7details13__impl_divremILi2EEEu2CMvbT__iS1_S1_u2CM
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb4_iS_(<4 x i32>, <4 x i32>) #16 {
-+define internal <4 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb4_iS_(<4 x i32>, <4 x i32>) #16 {
-   %3 = alloca <4 x i32>, align 16
-   %4 = alloca <4 x i32>, align 16
-   %5 = alloca <4 x i32>, align 16
-@@ -2490,7 +2490,7 @@ define internal <16 x i32> @_ZN7details13__impl_divremILi16EEEu2CMvbT__iS1_S1_u2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb32_iS_(<32 x i32>, <32 x i32>) #19 {
-+define internal <32 x i32> @_Z24__cm_intrinsic_impl_sdivu2CMvb32_iS_(<32 x i32>, <32 x i32>) #19 {
-   %3 = alloca <32 x i32>, align 128
-   %4 = alloca <32 x i32>, align 128
-   %5 = alloca <32 x i32>, align 128
-@@ -2676,7 +2676,7 @@ define internal <32 x i32> @_ZN7details13__impl_divremILi32EEEu2CMvbT__iS1_S1_u2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local i32 @_Z24__cm_intrinsic_impl_sremii(i32, i32) #14 {
-+define internal i32 @_Z24__cm_intrinsic_impl_sremii(i32, i32) #14 {
-   %3 = alloca i32, align 4
-   %4 = alloca i32, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -2702,7 +2702,7 @@ define dso_local i32 @_Z24__cm_intrinsic_impl_sremii(i32, i32) #14 {
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb1_iS_(<1 x i32>, <1 x i32>) #14 {
-+define internal <1 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb1_iS_(<1 x i32>, <1 x i32>) #14 {
-   %3 = alloca <1 x i32>, align 4
-   %4 = alloca <1 x i32>, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -2716,7 +2716,7 @@ define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb1_iS_(<1 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb2_iS_(<2 x i32>, <2 x i32>) #15 {
-+define internal <2 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb2_iS_(<2 x i32>, <2 x i32>) #15 {
-   %3 = alloca <2 x i32>, align 8
-   %4 = alloca <2 x i32>, align 8
-   %5 = alloca <2 x i32>, align 8
-@@ -2730,7 +2730,7 @@ define dso_local <2 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb2_iS_(<2 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb4_iS_(<4 x i32>, <4 x i32>) #16 {
-+define internal <4 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb4_iS_(<4 x i32>, <4 x i32>) #16 {
-   %3 = alloca <4 x i32>, align 16
-   %4 = alloca <4 x i32>, align 16
-   %5 = alloca <4 x i32>, align 16
-@@ -2744,7 +2744,7 @@ define dso_local <4 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb4_iS_(<4 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <8 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb8_iS_(<8 x i32>, <8 x i32>) #17 {
-+define internal <8 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb8_iS_(<8 x i32>, <8 x i32>) #17 {
-   %3 = alloca <8 x i32>, align 32
-   %4 = alloca <8 x i32>, align 32
-   %5 = alloca <8 x i32>, align 32
-@@ -2758,7 +2758,7 @@ define dso_local <8 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb8_iS_(<8 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <16 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb16_iS_(<16 x i32>, <16 x i32>) #18 {
-+define internal <16 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb16_iS_(<16 x i32>, <16 x i32>) #18 {
-   %3 = alloca <16 x i32>, align 64
-   %4 = alloca <16 x i32>, align 64
-   %5 = alloca <16 x i32>, align 64
-@@ -2772,7 +2772,7 @@ define dso_local <16 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb16_iS_(<16 x i32>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb32_iS_(<32 x i32>, <32 x i32>) #19 {
-+define internal <32 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb32_iS_(<32 x i32>, <32 x i32>) #19 {
-   %3 = alloca <32 x i32>, align 128
-   %4 = alloca <32 x i32>, align 128
-   %5 = alloca <32 x i32>, align 128
-@@ -2786,7 +2786,7 @@ define dso_local <32 x i32> @_Z24__cm_intrinsic_impl_sremu2CMvb32_iS_(<32 x i32>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local zeroext i8 @_Z24__cm_intrinsic_impl_udivhh(i8 zeroext, i8 zeroext) #21 {
-+define internal zeroext i8 @_Z24__cm_intrinsic_impl_udivhh(i8 zeroext, i8 zeroext) #21 {
-   %3 = alloca i8, align 1
-   %4 = alloca i8, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -2844,7 +2844,7 @@ define internal <1 x i8> @_ZN7details14__impl_udivremILi1EEEu2CMvbT__hS1_S1_u2CM
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb1_hS_(<1 x i8>, <1 x i8>) #21 {
-+define internal <1 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb1_hS_(<1 x i8>, <1 x i8>) #21 {
-   %3 = alloca <1 x i8>, align 1
-   %4 = alloca <1 x i8>, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -2860,7 +2860,7 @@ define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb1_hS_(<1 x i8>, <1
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb2_hS_(<2 x i8>, <2 x i8>) #22 {
-+define internal <2 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb2_hS_(<2 x i8>, <2 x i8>) #22 {
-   %3 = alloca <2 x i8>, align 2
-   %4 = alloca <2 x i8>, align 2
-   %5 = alloca <2 x i8>, align 2
-@@ -2906,7 +2906,7 @@ define internal <2 x i8> @_ZN7details14__impl_udivremILi2EEEu2CMvbT__hS1_S1_u2CM
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb4_hS_(<4 x i8>, <4 x i8>) #14 {
-+define internal <4 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb4_hS_(<4 x i8>, <4 x i8>) #14 {
-   %3 = alloca <4 x i8>, align 4
-   %4 = alloca <4 x i8>, align 4
-   %5 = alloca <4 x i8>, align 4
-@@ -3044,7 +3044,7 @@ define internal <16 x i8> @_ZN7details14__impl_udivremILi16EEEu2CMvbT__hS1_S1_u2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb32_hS_(<32 x i8>, <32 x i8>) #17 {
-+define internal <32 x i8> @_Z24__cm_intrinsic_impl_udivu2CMvb32_hS_(<32 x i8>, <32 x i8>) #17 {
-   %3 = alloca <32 x i8>, align 32
-   %4 = alloca <32 x i8>, align 32
-   %5 = alloca <32 x i8>, align 32
-@@ -3090,7 +3090,7 @@ define internal <32 x i8> @_ZN7details14__impl_udivremILi32EEEu2CMvbT__hS1_S1_u2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local zeroext i8 @_Z24__cm_intrinsic_impl_uremhh(i8 zeroext, i8 zeroext) #21 {
-+define internal zeroext i8 @_Z24__cm_intrinsic_impl_uremhh(i8 zeroext, i8 zeroext) #21 {
-   %3 = alloca i8, align 1
-   %4 = alloca i8, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -3116,7 +3116,7 @@ define dso_local zeroext i8 @_Z24__cm_intrinsic_impl_uremhh(i8 zeroext, i8 zeroe
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb1_hS_(<1 x i8>, <1 x i8>) #21 {
-+define internal <1 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb1_hS_(<1 x i8>, <1 x i8>) #21 {
-   %3 = alloca <1 x i8>, align 1
-   %4 = alloca <1 x i8>, align 1
-   %5 = alloca <1 x i8>, align 1
-@@ -3130,7 +3130,7 @@ define dso_local <1 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb1_hS_(<1 x i8>, <1
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb2_hS_(<2 x i8>, <2 x i8>) #22 {
-+define internal <2 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb2_hS_(<2 x i8>, <2 x i8>) #22 {
-   %3 = alloca <2 x i8>, align 2
-   %4 = alloca <2 x i8>, align 2
-   %5 = alloca <2 x i8>, align 2
-@@ -3144,7 +3144,7 @@ define dso_local <2 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb2_hS_(<2 x i8>, <2
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb4_hS_(<4 x i8>, <4 x i8>) #14 {
-+define internal <4 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb4_hS_(<4 x i8>, <4 x i8>) #14 {
-   %3 = alloca <4 x i8>, align 4
-   %4 = alloca <4 x i8>, align 4
-   %5 = alloca <4 x i8>, align 4
-@@ -3158,7 +3158,7 @@ define dso_local <4 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb4_hS_(<4 x i8>, <4
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <8 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb8_hS_(<8 x i8>, <8 x i8>) #15 {
-+define internal <8 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb8_hS_(<8 x i8>, <8 x i8>) #15 {
-   %3 = alloca <8 x i8>, align 8
-   %4 = alloca <8 x i8>, align 8
-   %5 = alloca <8 x i8>, align 8
-@@ -3172,7 +3172,7 @@ define dso_local <8 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb8_hS_(<8 x i8>, <8
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <16 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb16_hS_(<16 x i8>, <16 x i8>) #16 {
-+define internal <16 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb16_hS_(<16 x i8>, <16 x i8>) #16 {
-   %3 = alloca <16 x i8>, align 16
-   %4 = alloca <16 x i8>, align 16
-   %5 = alloca <16 x i8>, align 16
-@@ -3186,7 +3186,7 @@ define dso_local <16 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb16_hS_(<16 x i8>,
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb32_hS_(<32 x i8>, <32 x i8>) #17 {
-+define internal <32 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb32_hS_(<32 x i8>, <32 x i8>) #17 {
-   %3 = alloca <32 x i8>, align 32
-   %4 = alloca <32 x i8>, align 32
-   %5 = alloca <32 x i8>, align 32
-@@ -3200,7 +3200,7 @@ define dso_local <32 x i8> @_Z24__cm_intrinsic_impl_uremu2CMvb32_hS_(<32 x i8>,
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local zeroext i16 @_Z24__cm_intrinsic_impl_udivtt(i16 zeroext, i16 zeroext) #22 {
-+define internal zeroext i16 @_Z24__cm_intrinsic_impl_udivtt(i16 zeroext, i16 zeroext) #22 {
-   %3 = alloca i16, align 2
-   %4 = alloca i16, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -3278,7 +3278,7 @@ define internal <1 x i16> @_ZN7details14__impl_udivremILi1EEEu2CMvbT__tS1_S1_u2C
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb1_tS_(<1 x i16>, <1 x i16>) #22 {
-+define internal <1 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb1_tS_(<1 x i16>, <1 x i16>) #22 {
-   %3 = alloca <1 x i16>, align 2
-   %4 = alloca <1 x i16>, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -3294,7 +3294,7 @@ define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb1_tS_(<1 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb2_tS_(<2 x i16>, <2 x i16>) #14 {
-+define internal <2 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb2_tS_(<2 x i16>, <2 x i16>) #14 {
-   %3 = alloca <2 x i16>, align 4
-   %4 = alloca <2 x i16>, align 4
-   %5 = alloca <2 x i16>, align 4
-@@ -3360,7 +3360,7 @@ define internal <2 x i16> @_ZN7details14__impl_udivremILi2EEEu2CMvbT__tS1_S1_u2C
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb4_tS_(<4 x i16>, <4 x i16>) #15 {
-+define internal <4 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb4_tS_(<4 x i16>, <4 x i16>) #15 {
-   %3 = alloca <4 x i16>, align 8
-   %4 = alloca <4 x i16>, align 8
-   %5 = alloca <4 x i16>, align 8
-@@ -3558,7 +3558,7 @@ define internal <16 x i16> @_ZN7details14__impl_udivremILi16EEEu2CMvbT__tS1_S1_u
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb32_tS_(<32 x i16>, <32 x i16>) #18 {
-+define internal <32 x i16> @_Z24__cm_intrinsic_impl_udivu2CMvb32_tS_(<32 x i16>, <32 x i16>) #18 {
-   %3 = alloca <32 x i16>, align 64
-   %4 = alloca <32 x i16>, align 64
-   %5 = alloca <32 x i16>, align 64
-@@ -3624,7 +3624,7 @@ define internal <32 x i16> @_ZN7details14__impl_udivremILi32EEEu2CMvbT__tS1_S1_u
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local zeroext i16 @_Z24__cm_intrinsic_impl_uremtt(i16 zeroext, i16 zeroext) #22 {
-+define internal zeroext i16 @_Z24__cm_intrinsic_impl_uremtt(i16 zeroext, i16 zeroext) #22 {
-   %3 = alloca i16, align 2
-   %4 = alloca i16, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -3650,7 +3650,7 @@ define dso_local zeroext i16 @_Z24__cm_intrinsic_impl_uremtt(i16 zeroext, i16 ze
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb1_tS_(<1 x i16>, <1 x i16>) #22 {
-+define internal <1 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb1_tS_(<1 x i16>, <1 x i16>) #22 {
-   %3 = alloca <1 x i16>, align 2
-   %4 = alloca <1 x i16>, align 2
-   %5 = alloca <1 x i16>, align 2
-@@ -3664,7 +3664,7 @@ define dso_local <1 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb1_tS_(<1 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb2_tS_(<2 x i16>, <2 x i16>) #14 {
-+define internal <2 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb2_tS_(<2 x i16>, <2 x i16>) #14 {
-   %3 = alloca <2 x i16>, align 4
-   %4 = alloca <2 x i16>, align 4
-   %5 = alloca <2 x i16>, align 4
-@@ -3678,7 +3678,7 @@ define dso_local <2 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb2_tS_(<2 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb4_tS_(<4 x i16>, <4 x i16>) #15 {
-+define internal <4 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb4_tS_(<4 x i16>, <4 x i16>) #15 {
-   %3 = alloca <4 x i16>, align 8
-   %4 = alloca <4 x i16>, align 8
-   %5 = alloca <4 x i16>, align 8
-@@ -3692,7 +3692,7 @@ define dso_local <4 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb4_tS_(<4 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <8 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb8_tS_(<8 x i16>, <8 x i16>) #16 {
-+define internal <8 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb8_tS_(<8 x i16>, <8 x i16>) #16 {
-   %3 = alloca <8 x i16>, align 16
-   %4 = alloca <8 x i16>, align 16
-   %5 = alloca <8 x i16>, align 16
-@@ -3706,7 +3706,7 @@ define dso_local <8 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb8_tS_(<8 x i16>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <16 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb16_tS_(<16 x i16>, <16 x i16>) #17 {
-+define internal <16 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb16_tS_(<16 x i16>, <16 x i16>) #17 {
-   %3 = alloca <16 x i16>, align 32
-   %4 = alloca <16 x i16>, align 32
-   %5 = alloca <16 x i16>, align 32
-@@ -3720,7 +3720,7 @@ define dso_local <16 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb16_tS_(<16 x i16>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb32_tS_(<32 x i16>, <32 x i16>) #18 {
-+define internal <32 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb32_tS_(<32 x i16>, <32 x i16>) #18 {
-   %3 = alloca <32 x i16>, align 64
-   %4 = alloca <32 x i16>, align 64
-   %5 = alloca <32 x i16>, align 64
-@@ -3734,7 +3734,7 @@ define dso_local <32 x i16> @_Z24__cm_intrinsic_impl_uremu2CMvb32_tS_(<32 x i16>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local i32 @_Z24__cm_intrinsic_impl_udivjj(i32, i32) #14 {
-+define internal i32 @_Z24__cm_intrinsic_impl_udivjj(i32, i32) #14 {
-   %3 = alloca i32, align 4
-   %4 = alloca i32, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -3892,7 +3892,7 @@ define internal <1 x i32> @_ZN7details14__impl_udivremILi1EEEu2CMvbT__jS1_S1_u2C
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb1_jS_(<1 x i32>, <1 x i32>) #14 {
-+define internal <1 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb1_jS_(<1 x i32>, <1 x i32>) #14 {
-   %3 = alloca <1 x i32>, align 4
-   %4 = alloca <1 x i32>, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -3908,7 +3908,7 @@ define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb1_jS_(<1 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb2_jS_(<2 x i32>, <2 x i32>) #15 {
-+define internal <2 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb2_jS_(<2 x i32>, <2 x i32>) #15 {
-   %3 = alloca <2 x i32>, align 8
-   %4 = alloca <2 x i32>, align 8
-   %5 = alloca <2 x i32>, align 8
-@@ -4054,7 +4054,7 @@ define internal <2 x i32> @_ZN7details14__impl_udivremILi2EEEu2CMvbT__jS1_S1_u2C
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb4_jS_(<4 x i32>, <4 x i32>) #16 {
-+define internal <4 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb4_jS_(<4 x i32>, <4 x i32>) #16 {
-   %3 = alloca <4 x i32>, align 16
-   %4 = alloca <4 x i32>, align 16
-   %5 = alloca <4 x i32>, align 16
-@@ -4492,7 +4492,7 @@ define internal <16 x i32> @_ZN7details14__impl_udivremILi16EEEu2CMvbT__jS1_S1_u
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb32_jS_(<32 x i32>, <32 x i32>) #19 {
-+define internal <32 x i32> @_Z24__cm_intrinsic_impl_udivu2CMvb32_jS_(<32 x i32>, <32 x i32>) #19 {
-   %3 = alloca <32 x i32>, align 128
-   %4 = alloca <32 x i32>, align 128
-   %5 = alloca <32 x i32>, align 128
-@@ -4638,7 +4638,7 @@ define internal <32 x i32> @_ZN7details14__impl_udivremILi32EEEu2CMvbT__jS1_S1_u
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local i32 @_Z24__cm_intrinsic_impl_uremjj(i32, i32) #14 {
-+define internal i32 @_Z24__cm_intrinsic_impl_uremjj(i32, i32) #14 {
-   %3 = alloca i32, align 4
-   %4 = alloca i32, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -4664,7 +4664,7 @@ define dso_local i32 @_Z24__cm_intrinsic_impl_uremjj(i32, i32) #14 {
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb1_jS_(<1 x i32>, <1 x i32>) #14 {
-+define internal <1 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb1_jS_(<1 x i32>, <1 x i32>) #14 {
-   %3 = alloca <1 x i32>, align 4
-   %4 = alloca <1 x i32>, align 4
-   %5 = alloca <1 x i32>, align 4
-@@ -4678,7 +4678,7 @@ define dso_local <1 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb1_jS_(<1 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <2 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb2_jS_(<2 x i32>, <2 x i32>) #15 {
-+define internal <2 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb2_jS_(<2 x i32>, <2 x i32>) #15 {
-   %3 = alloca <2 x i32>, align 8
-   %4 = alloca <2 x i32>, align 8
-   %5 = alloca <2 x i32>, align 8
-@@ -4692,7 +4692,7 @@ define dso_local <2 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb2_jS_(<2 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <4 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb4_jS_(<4 x i32>, <4 x i32>) #16 {
-+define internal <4 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb4_jS_(<4 x i32>, <4 x i32>) #16 {
-   %3 = alloca <4 x i32>, align 16
-   %4 = alloca <4 x i32>, align 16
-   %5 = alloca <4 x i32>, align 16
-@@ -4706,7 +4706,7 @@ define dso_local <4 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb4_jS_(<4 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <8 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb8_jS_(<8 x i32>, <8 x i32>) #17 {
-+define internal <8 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb8_jS_(<8 x i32>, <8 x i32>) #17 {
-   %3 = alloca <8 x i32>, align 32
-   %4 = alloca <8 x i32>, align 32
-   %5 = alloca <8 x i32>, align 32
-@@ -4720,7 +4720,7 @@ define dso_local <8 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb8_jS_(<8 x i32>, <
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <16 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb16_jS_(<16 x i32>, <16 x i32>) #18 {
-+define internal <16 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb16_jS_(<16 x i32>, <16 x i32>) #18 {
-   %3 = alloca <16 x i32>, align 64
-   %4 = alloca <16 x i32>, align 64
-   %5 = alloca <16 x i32>, align 64
-@@ -4734,7 +4734,7 @@ define dso_local <16 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb16_jS_(<16 x i32>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local <32 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb32_jS_(<32 x i32>, <32 x i32>) #19 {
-+define internal <32 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb32_jS_(<32 x i32>, <32 x i32>) #19 {
-   %3 = alloca <32 x i32>, align 128
-   %4 = alloca <32 x i32>, align 128
-   %5 = alloca <32 x i32>, align 128
-@@ -4748,7 +4748,7 @@ define dso_local <32 x i32> @_Z24__cm_intrinsic_impl_uremu2CMvb32_jS_(<32 x i32>
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local void @__do_print_cm(i8*, i8*, i32, i64, i32*, i32, i32) #23 !dbg !15 {
-+define internal void @__do_print_cm(i8*, i8*, i32, i64, i32*, i32, i32) #23 !dbg !15 {
-   %8 = alloca i8*, align 8
-   %9 = alloca i8*, align 8
-   %10 = alloca i32, align 4
-@@ -5070,7 +5070,7 @@ define dso_local void @__do_print_lz(i32, i8*, i32, i64, i32*, i32, i32, i32, i3
-   %67 = load i64, i64* %13, align 8, !dbg !159, !tbaa !19
-   %68 = load <5 x i32>, <5 x i32>* %21, align 32, !dbg !160, !tbaa !7
-   call void @_ZN13VaryingWriterC2ERyRPKjiyu2CMvb5_i(%class.VaryingWriter* %23, i64* dereferenceable(8) %19, i32** dereferenceable(8) %14, i32 %66, i64 %67, <5 x i32> %68), !dbg !161
--  %69 = call zeroext i1 @_ZN9PrintInfo14switchEncodingI13UniformWriter13VaryingWriterEEbNS_8EncodingET_T0_(i8 signext %62, %class.UniformWriter* byval align 32 %22, %class.VaryingWriter* byval align 32 %23), !dbg !162
-+  %69 = call zeroext i1 @_ZN9PrintInfo14switchEncodingI13UniformWriter13VaryingWriterEEbNS_8EncodingET_T0_(i8 signext %62, %class.UniformWriter* byval(%class.UniformWriter) align 32 %22, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %23), !dbg !162
-   br label %70, !dbg !163
- 
- ; <label>:70:                                     ; preds = %60
-@@ -5188,7 +5188,7 @@ define internal <5 x i32> @_Z17get_auxiliary_strv() #28 comdat !dbg !178 {
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo14switchEncodingI13UniformWriter13VaryingWriterEEbNS_8EncodingET_T0_(i8 signext, %class.UniformWriter* byval align 32, %class.VaryingWriter* byval align 32) #25 comdat !dbg !191 {
-+define internal zeroext i1 @_ZN9PrintInfo14switchEncodingI13UniformWriter13VaryingWriterEEbNS_8EncodingET_T0_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %class.VaryingWriter* byval(%class.VaryingWriter) align 32) #25 comdat !dbg !191 {
-   %4 = alloca i8, align 1
-   %5 = alloca %class.UniformWriter, align 32
-   %6 = alloca %class.VaryingWriter, align 32
-@@ -5197,7 +5197,7 @@ define internal zeroext i1 @_ZN9PrintInfo14switchEncodingI13UniformWriter13Varyi
-   %8 = bitcast %class.UniformWriter* %5 to i8*, !dbg !196
-   %9 = bitcast %class.UniformWriter* %1 to i8*, !dbg !196
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %8, i8* align 32 %9, i64 64, i1 false), !dbg !196, !tbaa.struct !197
--  %10 = call zeroext i1 @_ZN9PrintInfo22switchEncoding4UniformI13UniformWriterEEbNS_8EncodingET_(i8 signext %7, %class.UniformWriter* byval align 32 %5), !dbg !198
-+  %10 = call zeroext i1 @_ZN9PrintInfo22switchEncoding4UniformI13UniformWriterEEbNS_8EncodingET_(i8 signext %7, %class.UniformWriter* byval(%class.UniformWriter) align 32 %5), !dbg !198
-   br i1 %10, label %16, label %11, !dbg !199
- 
- ; <label>:11:                                     ; preds = %3
-@@ -5205,7 +5205,7 @@ define internal zeroext i1 @_ZN9PrintInfo14switchEncodingI13UniformWriter13Varyi
-   %13 = bitcast %class.VaryingWriter* %6 to i8*, !dbg !201
-   %14 = bitcast %class.VaryingWriter* %2 to i8*, !dbg !201
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %13, i8* align 32 %14, i64 64, i1 false), !dbg !201, !tbaa.struct !197
--  %15 = call zeroext i1 @_ZN9PrintInfo22switchEncoding4VaryingI13VaryingWriterEEbNS_8EncodingET_(i8 signext %12, %class.VaryingWriter* byval align 32 %6), !dbg !202
-+  %15 = call zeroext i1 @_ZN9PrintInfo22switchEncoding4VaryingI13VaryingWriterEEbNS_8EncodingET_(i8 signext %12, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %6), !dbg !202
-   br label %16, !dbg !199
- 
- ; <label>:16:                                     ; preds = %11, %3
-@@ -5280,7 +5280,7 @@ define internal void @_ZN13VaryingWriterC2ERyRPKjiyu2CMvb5_i(%class.VaryingWrite
- }
- 
- ; Function Attrs: noinline nounwind
--define dso_local i32 @__num_cores() #29 !dbg !236 {
-+define internal i32 @__num_cores() #29 !dbg !236 {
-   ret i32 -1, !dbg !237
- }
- 
-@@ -8870,7 +8870,7 @@ declare dso_local void @_ZN7details37__cm_intrinsic_impl_svm_scatter_writeIiLi1E
- declare void @llvm.genx.svm.scatter.v1i1.v1i64.v1i32(<1 x i1>, i32, <1 x i64>, <1 x i32>) #27
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4UniformI13UniformWriterEEbNS_8EncodingET_(i8 signext, %class.UniformWriter* byval align 32) #25 comdat !dbg !1645 {
-+define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4UniformI13UniformWriterEEbNS_8EncodingET_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32) #25 comdat !dbg !1645 {
-   %3 = alloca i8, align 1
-   %4 = alloca %class.UniformWriter, align 32
-   %5 = alloca %"struct.PrintInfo::Encoding4Uniform", align 1
-@@ -8879,7 +8879,7 @@ define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4UniformI13UniformWrite
-   %7 = bitcast %class.UniformWriter* %4 to i8*, !dbg !1647
-   %8 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1647
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %7, i8* align 32 %8, i64 64, i1 false), !dbg !1647, !tbaa.struct !197
--  %9 = call zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET_T0_(i8 signext %6, %class.UniformWriter* byval align 32 %4, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %5), !dbg !1648
-+  %9 = call zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET_T0_(i8 signext %6, %class.UniformWriter* byval(%class.UniformWriter) align 32 %4, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %5), !dbg !1648
-   ret i1 %9, !dbg !1649
- }
- 
-@@ -8887,7 +8887,7 @@ define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4UniformI13UniformWrite
- declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) #32
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4VaryingI13VaryingWriterEEbNS_8EncodingET_(i8 signext, %class.VaryingWriter* byval align 32) #25 comdat !dbg !1650 {
-+define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4VaryingI13VaryingWriterEEbNS_8EncodingET_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32) #25 comdat !dbg !1650 {
-   %3 = alloca i8, align 1
-   %4 = alloca %class.VaryingWriter, align 32
-   %5 = alloca %"struct.PrintInfo::Encoding4Varying", align 1
-@@ -8896,12 +8896,12 @@ define internal zeroext i1 @_ZN9PrintInfo22switchEncoding4VaryingI13VaryingWrite
-   %7 = bitcast %class.VaryingWriter* %4 to i8*, !dbg !1652
-   %8 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !1652
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %7, i8* align 32 %8, i64 64, i1 false), !dbg !1652, !tbaa.struct !197
--  %9 = call zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET_T0_(i8 signext %6, %class.VaryingWriter* byval align 32 %4, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %5), !dbg !1653
-+  %9 = call zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET_T0_(i8 signext %6, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %4, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %5), !dbg !1653
-   ret i1 %9, !dbg !1654
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET_T0_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1655 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET_T0_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1655 {
-   %4 = alloca i8, align 1
-   %5 = alloca %class.UniformWriter, align 32
-   %6 = alloca %"struct.PrintInfo::Encoding4Uniform", align 1
-@@ -8924,7 +8924,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %22 = bitcast %class.UniformWriter* %5 to i8*, !dbg !1657
-   %23 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1657
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %22, i8* align 32 %23, i64 64, i1 false), !dbg !1657, !tbaa.struct !197
--  %24 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %21, %class.UniformWriter* byval align 32 %5, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %6), !dbg !1658
-+  %24 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %21, %class.UniformWriter* byval(%class.UniformWriter) align 32 %5, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %6), !dbg !1658
-   br i1 %24, label %60, label %25, !dbg !1659
- 
- ; <label>:25:                                     ; preds = %3
-@@ -8932,7 +8932,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %27 = bitcast %class.UniformWriter* %7 to i8*, !dbg !1661
-   %28 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1661
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %27, i8* align 32 %28, i64 64, i1 false), !dbg !1661, !tbaa.struct !197
--  %29 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %26, %class.UniformWriter* byval align 32 %7, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %8), !dbg !1662
-+  %29 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %26, %class.UniformWriter* byval(%class.UniformWriter) align 32 %7, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %8), !dbg !1662
-   br i1 %29, label %60, label %30, !dbg !1663
- 
- ; <label>:30:                                     ; preds = %25
-@@ -8940,7 +8940,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %32 = bitcast %class.UniformWriter* %9 to i8*, !dbg !1665
-   %33 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1665
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %32, i8* align 32 %33, i64 64, i1 false), !dbg !1665, !tbaa.struct !197
--  %34 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %31, %class.UniformWriter* byval align 32 %9, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %10), !dbg !1666
-+  %34 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %31, %class.UniformWriter* byval(%class.UniformWriter) align 32 %9, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %10), !dbg !1666
-   br i1 %34, label %60, label %35, !dbg !1667
- 
- ; <label>:35:                                     ; preds = %30
-@@ -8948,7 +8948,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %37 = bitcast %class.UniformWriter* %11 to i8*, !dbg !1669
-   %38 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1669
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %37, i8* align 32 %38, i64 64, i1 false), !dbg !1669, !tbaa.struct !197
--  %39 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %36, %class.UniformWriter* byval align 32 %11, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %12), !dbg !1670
-+  %39 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %36, %class.UniformWriter* byval(%class.UniformWriter) align 32 %11, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %12), !dbg !1670
-   br i1 %39, label %60, label %40, !dbg !1671
- 
- ; <label>:40:                                     ; preds = %35
-@@ -8956,7 +8956,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %42 = bitcast %class.UniformWriter* %13 to i8*, !dbg !1673
-   %43 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1673
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %42, i8* align 32 %43, i64 64, i1 false), !dbg !1673, !tbaa.struct !197
--  %44 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %41, %class.UniformWriter* byval align 32 %13, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %14), !dbg !1674
-+  %44 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %41, %class.UniformWriter* byval(%class.UniformWriter) align 32 %13, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %14), !dbg !1674
-   br i1 %44, label %60, label %45, !dbg !1675
- 
- ; <label>:45:                                     ; preds = %40
-@@ -8964,7 +8964,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %47 = bitcast %class.UniformWriter* %15 to i8*, !dbg !1677
-   %48 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1677
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %47, i8* align 32 %48, i64 64, i1 false), !dbg !1677, !tbaa.struct !197
--  %49 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %46, %class.UniformWriter* byval align 32 %15, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %16), !dbg !1678
-+  %49 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %46, %class.UniformWriter* byval(%class.UniformWriter) align 32 %15, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %16), !dbg !1678
-   br i1 %49, label %60, label %50, !dbg !1679
- 
- ; <label>:50:                                     ; preds = %45
-@@ -8972,7 +8972,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %52 = bitcast %class.UniformWriter* %17 to i8*, !dbg !1681
-   %53 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1681
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %52, i8* align 32 %53, i64 64, i1 false), !dbg !1681, !tbaa.struct !197
--  %54 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %51, %class.UniformWriter* byval align 32 %17, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %18), !dbg !1682
-+  %54 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %51, %class.UniformWriter* byval(%class.UniformWriter) align 32 %17, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %18), !dbg !1682
-   br i1 %54, label %60, label %55, !dbg !1683
- 
- ; <label>:55:                                     ; preds = %50
-@@ -8980,7 +8980,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
-   %57 = bitcast %class.UniformWriter* %19 to i8*, !dbg !1685
-   %58 = bitcast %class.UniformWriter* %1 to i8*, !dbg !1685
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %57, i8* align 32 %58, i64 64, i1 false), !dbg !1685, !tbaa.struct !197
--  %59 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %56, %class.UniformWriter* byval align 32 %19, %"struct.PrintInfo::Encoding4Uniform"* byval align 1 %20), !dbg !1686
-+  %59 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext %56, %class.UniformWriter* byval(%class.UniformWriter) align 32 %19, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1 %20), !dbg !1686
-   br label %60, !dbg !1683
- 
- ; <label>:60:                                     ; preds = %55, %50, %45, %40, %35, %30, %25, %3
-@@ -8989,7 +8989,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13UniformWriter
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1688 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1688 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9015,7 +9015,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1697 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1697 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9041,7 +9041,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1706 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1706 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9067,7 +9067,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1715 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1715 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9093,7 +9093,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1724 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1724 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9119,7 +9119,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1733 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1733 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9145,7 +9145,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1742 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1742 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -9171,7 +9171,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13Unifo
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval align 32, %"struct.PrintInfo::Encoding4Uniform"* byval align 1) #25 comdat !dbg !1751 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13UniformWriterNS_16Encoding4UniformEEEbNS_8EncodingET0_T1_(i8 signext, %class.UniformWriter* byval(%class.UniformWriter) align 32, %"struct.PrintInfo::Encoding4Uniform"* byval(%"struct.PrintInfo::Encoding4Uniform") align 1) #25 comdat !dbg !1751 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10013,7 +10013,7 @@ define internal i32 @_ZN7details18_cm_print_type_oclIPvEENS_18SHADER_PRINTF_TYPE
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET_T0_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2061 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET_T0_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2061 {
-   %4 = alloca i8, align 1
-   %5 = alloca %class.VaryingWriter, align 32
-   %6 = alloca %"struct.PrintInfo::Encoding4Varying", align 1
-@@ -10036,7 +10036,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %22 = bitcast %class.VaryingWriter* %5 to i8*, !dbg !2063
-   %23 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2063
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %22, i8* align 32 %23, i64 64, i1 false), !dbg !2063, !tbaa.struct !197
--  %24 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %21, %class.VaryingWriter* byval align 32 %5, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %6), !dbg !2064
-+  %24 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %21, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %5, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %6), !dbg !2064
-   br i1 %24, label %60, label %25, !dbg !2065
- 
- ; <label>:25:                                     ; preds = %3
-@@ -10044,7 +10044,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %27 = bitcast %class.VaryingWriter* %7 to i8*, !dbg !2067
-   %28 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2067
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %27, i8* align 32 %28, i64 64, i1 false), !dbg !2067, !tbaa.struct !197
--  %29 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %26, %class.VaryingWriter* byval align 32 %7, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %8), !dbg !2068
-+  %29 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %26, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %7, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %8), !dbg !2068
-   br i1 %29, label %60, label %30, !dbg !2069
- 
- ; <label>:30:                                     ; preds = %25
-@@ -10052,7 +10052,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %32 = bitcast %class.VaryingWriter* %9 to i8*, !dbg !2071
-   %33 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2071
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %32, i8* align 32 %33, i64 64, i1 false), !dbg !2071, !tbaa.struct !197
--  %34 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %31, %class.VaryingWriter* byval align 32 %9, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %10), !dbg !2072
-+  %34 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %31, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %9, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %10), !dbg !2072
-   br i1 %34, label %60, label %35, !dbg !2073
- 
- ; <label>:35:                                     ; preds = %30
-@@ -10060,7 +10060,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %37 = bitcast %class.VaryingWriter* %11 to i8*, !dbg !2075
-   %38 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2075
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %37, i8* align 32 %38, i64 64, i1 false), !dbg !2075, !tbaa.struct !197
--  %39 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %36, %class.VaryingWriter* byval align 32 %11, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %12), !dbg !2076
-+  %39 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %36, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %11, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %12), !dbg !2076
-   br i1 %39, label %60, label %40, !dbg !2077
- 
- ; <label>:40:                                     ; preds = %35
-@@ -10068,7 +10068,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %42 = bitcast %class.VaryingWriter* %13 to i8*, !dbg !2079
-   %43 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2079
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %42, i8* align 32 %43, i64 64, i1 false), !dbg !2079, !tbaa.struct !197
--  %44 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %41, %class.VaryingWriter* byval align 32 %13, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %14), !dbg !2080
-+  %44 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %41, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %13, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %14), !dbg !2080
-   br i1 %44, label %60, label %45, !dbg !2081
- 
- ; <label>:45:                                     ; preds = %40
-@@ -10076,7 +10076,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %47 = bitcast %class.VaryingWriter* %15 to i8*, !dbg !2083
-   %48 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2083
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %47, i8* align 32 %48, i64 64, i1 false), !dbg !2083, !tbaa.struct !197
--  %49 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %46, %class.VaryingWriter* byval align 32 %15, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %16), !dbg !2084
-+  %49 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %46, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %15, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %16), !dbg !2084
-   br i1 %49, label %60, label %50, !dbg !2085
- 
- ; <label>:50:                                     ; preds = %45
-@@ -10084,7 +10084,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %52 = bitcast %class.VaryingWriter* %17 to i8*, !dbg !2087
-   %53 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2087
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %52, i8* align 32 %53, i64 64, i1 false), !dbg !2087, !tbaa.struct !197
--  %54 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %51, %class.VaryingWriter* byval align 32 %17, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %18), !dbg !2088
-+  %54 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %51, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %17, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %18), !dbg !2088
-   br i1 %54, label %60, label %55, !dbg !2089
- 
- ; <label>:55:                                     ; preds = %50
-@@ -10092,7 +10092,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
-   %57 = bitcast %class.VaryingWriter* %19 to i8*, !dbg !2091
-   %58 = bitcast %class.VaryingWriter* %1 to i8*, !dbg !2091
-   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 32 %57, i8* align 32 %58, i64 64, i1 false), !dbg !2091, !tbaa.struct !197
--  %59 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %56, %class.VaryingWriter* byval align 32 %19, %"struct.PrintInfo::Encoding4Varying"* byval align 1 %20), !dbg !2092
-+  %59 = call zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext %56, %class.VaryingWriter* byval(%class.VaryingWriter) align 32 %19, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1 %20), !dbg !2092
-   br label %60, !dbg !2089
- 
- ; <label>:60:                                     ; preds = %55, %50, %45, %40, %35, %30, %25, %3
-@@ -10101,7 +10101,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail14switchEncodingI13VaryingWriter
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2094 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2094 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10127,7 +10127,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIb13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2103 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2103 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10153,7 +10153,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIi13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2112 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2112 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10179,7 +10179,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIj13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2121 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2121 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10205,7 +10205,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIf13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2130 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2130 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10231,7 +10231,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIx13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2139 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2139 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10257,7 +10257,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIy13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2148 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2148 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
-@@ -10283,7 +10283,7 @@ define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingId13Varyi
- }
- 
- ; Function Attrs: alwaysinline inlinehint nounwind
--define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval align 32, %"struct.PrintInfo::Encoding4Varying"* byval align 1) #25 comdat !dbg !2157 {
-+define internal zeroext i1 @_ZN9PrintInfo6detail21applyIfProperEncodingIPv13VaryingWriterNS_16Encoding4VaryingEEEbNS_8EncodingET0_T1_(i8 signext, %class.VaryingWriter* byval(%class.VaryingWriter) align 32, %"struct.PrintInfo::Encoding4Varying"* byval(%"struct.PrintInfo::Encoding4Varying") align 1) #25 comdat !dbg !2157 {
-   %4 = alloca i1, align 1
-   %5 = alloca i8, align 1
-   store i8 %0, i8* %5, align 1, !tbaa !193
diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 9c3acb42a9cf..68fed5a4c659 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,10 +1,10 @@
 # Template file for 'ispc'
 pkgname=ispc
-version=1.15.0
-revision=2
+version=1.17.0
+revision=1
 archs="x86_64*"
 build_style=cmake
-configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"
+configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF -DCMAKE_BUILD_TYPE=Release"
 hostmakedepends="clang clang-tools-extra python3 m4 bison flex llvm"
 makedepends="ncurses-devel ncurses-libtinfo-devel zlib-devel"
 short_desc="Compiler for high-performance SIMD programming on the CPU"
@@ -12,7 +12,7 @@ maintainer="Andrea Brancaleoni <abc@pompel.me>"
 license="BSD-3-Clause"
 homepage="https://ispc.github.io"
 distfiles="https://github.com/ispc/ispc/archive/v${version}.tar.gz"
-checksum=2658ff00dc045ac9fcefbf6bd26dffaf723b059a942a27df91bbb61bc503a285
+checksum=37fb1055d6c6b232e112d8d50145d726824ed4d8da93a7396315dceba6c76e62
 nocross=yes
 nopie=yes
 

From 1b293759fc634837816020bf5f3a3cc82776d5a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 28 Feb 2022 21:47:24 +0000
Subject: [PATCH 18/30] zig: update to 0.9.1.

---
 .../0001-std.build-fix-handling-of-Dcpu.patch | 48 -------------------
 srcpkgs/zig/template                          |  8 ++--
 2 files changed, 4 insertions(+), 52 deletions(-)
 delete mode 100644 srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch

diff --git a/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch b/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch
deleted file mode 100644
index 4101f24459bb..000000000000
--- a/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From 1e8cdace7ad324a42228aeb5cd6eb8dd15429413 Mon Sep 17 00:00:00 2001
-From: Isaac Freund <ifreund@ifreund.xyz>
-Date: Tue, 21 Sep 2021 21:06:10 +0200
-Subject: [PATCH] std.build: fix handling of -Dcpu
-
-Currently -Dcpu is completely ignored if -Dtarget isn't passed as well.
-Further, -Dcpu=baseline is ignored even if -Dtarget=native is passed.
-
-This patch fixes these 2 issues, always respecting the -Dcpu option if
-present.
----
- lib/std/build.zig | 13 +++++++------
- 1 file changed, 7 insertions(+), 6 deletions(-)
-
-diff --git a/lib/std/build.zig b/lib/std/build.zig
-index 9b7ebb1f4..e398529f9 100644
---- a/lib/std/build.zig
-+++ b/lib/std/build.zig
-@@ -685,7 +685,11 @@ pub const Builder = struct {
-         );
-         const mcpu = self.option([]const u8, "cpu", "Target CPU");
- 
--        const triple = maybe_triple orelse return args.default_target;
-+        if (maybe_triple == null and mcpu == null) {
-+            return args.default_target;
-+        }
-+
-+        const triple = maybe_triple orelse "native";
- 
-         var diags: CrossTarget.ParseOptions.Diagnostics = .{};
-         const selected_target = CrossTarget.parse(.{
-@@ -2451,11 +2455,8 @@ pub const LibExeObjStep = struct {
- 
-             if (populated_cpu_features.eql(cross.cpu.features)) {
-                 // The CPU name alone is sufficient.
--                // If it is the baseline CPU, no command line args are required.
--                if (cross.cpu.model != std.Target.Cpu.baseline(cross.cpu.arch).model) {
--                    try zig_args.append("-mcpu");
--                    try zig_args.append(cross.cpu.model.name);
--                }
-+                try zig_args.append("-mcpu");
-+                try zig_args.append(cross.cpu.model.name);
-             } else {
-                 var mcpu_buffer = std.ArrayList(u8).init(builder.allocator);
- 
--- 
-2.33.1
-
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index 728c5a64e9df..4832c8938160 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,17 +1,17 @@
 # Template file for 'zig'
 pkgname=zig
-version=0.8.1
-revision=2
+version=0.9.1
+revision=1
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
-makedepends="clang llvm12 lld-devel"
+makedepends="clang llvm13 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
 maintainer="Isaac Freund <mail@isaacfreund.com>"
 license="MIT"
 homepage="https://ziglang.org"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
-checksum=8c428e14a0a89cb7a15a6768424a37442292858cdb695e2eb503fa3c7bf47f1a
+checksum=38cf4e84481f5facc766ba72783e7462e08d6d29a5d47e3b75c8ee3142485210
 nopie=yes
 nocross=yes
 

From d875baa249c80bb1ec224cae3ffc1e9fb946106d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 28 Feb 2022 21:52:07 +0000
Subject: [PATCH 19/30] beignet: remove package

---
 srcpkgs/beignet/patches/cl_uint.patch         |  22 -
 ...419a0008e38ef2d9d255d9e9c74e9fba084b.patch | 134 ---
 srcpkgs/beignet/patches/llvm06.patch          |  33 -
 srcpkgs/beignet/patches/llvm08.patch          |  56 --
 srcpkgs/beignet/patches/llvm09.patch          | 111 ---
 srcpkgs/beignet/patches/llvm10.patch          | 347 -------
 srcpkgs/beignet/patches/llvm11.patch          | 937 ------------------
 srcpkgs/beignet/patches/llvm12.patch          | 115 ---
 srcpkgs/beignet/patches/musl.patch            |  11 -
 srcpkgs/beignet/template                      |  22 -
 srcpkgs/beignet/update                        |   1 -
 srcpkgs/removed-packages/template             |   1 +
 12 files changed, 1 insertion(+), 1789 deletions(-)
 delete mode 100644 srcpkgs/beignet/patches/cl_uint.patch
 delete mode 100644 srcpkgs/beignet/patches/e1b2419a0008e38ef2d9d255d9e9c74e9fba084b.patch
 delete mode 100644 srcpkgs/beignet/patches/llvm06.patch
 delete mode 100644 srcpkgs/beignet/patches/llvm08.patch
 delete mode 100644 srcpkgs/beignet/patches/llvm09.patch
 delete mode 100644 srcpkgs/beignet/patches/llvm10.patch
 delete mode 100644 srcpkgs/beignet/patches/llvm11.patch
 delete mode 100644 srcpkgs/beignet/patches/llvm12.patch
 delete mode 100644 srcpkgs/beignet/patches/musl.patch
 delete mode 100644 srcpkgs/beignet/template
 delete mode 100644 srcpkgs/beignet/update

diff --git a/srcpkgs/beignet/patches/cl_uint.patch b/srcpkgs/beignet/patches/cl_uint.patch
deleted file mode 100644
index 86ba00f04e95..000000000000
--- a/srcpkgs/beignet/patches/cl_uint.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- a/src/cl_api_kernel.c	2017-09-22 10:05:22.000000000 +0200
-+++ b/src/cl_api_kernel.c	2020-03-24 18:27:40.186485887 +0100
-@@ -151,7 +151,7 @@
-         fixed_local_sz[0] = 16;
-         fixed_local_sz[1] = 1;
-       } else {
--        uint j, maxDimSize = 64 /* from 64? */, maxGroupSize = 256; //MAX_WORK_GROUP_SIZE may too large
-+        cl_uint j, maxDimSize = 64 /* from 64? */, maxGroupSize = 256; //MAX_WORK_GROUP_SIZE may too large
-         size_t realGroupSize = 1;
-         for (i = 0; i < work_dim; i++) {
-           for (j = maxDimSize; j > 1; j--) {
---- a/src/cl_enqueue.c	2017-09-22 10:05:22.000000000 +0200
-+++ b/src/cl_enqueue.c	2020-03-24 18:30:12.031479833 +0100
-@@ -494,7 +494,7 @@
- cl_int cl_enqueue_svm_free(enqueue_data *data, cl_int status) {
-   int i;
-   void **pointers = data->pointers;
--  uint num_svm_ptrs = data->size;
-+  cl_uint num_svm_ptrs = data->size;
-   cl_int err = CL_SUCCESS;
- 
-   if (status != CL_COMPLETE)
diff --git a/srcpkgs/beignet/patches/e1b2419a0008e38ef2d9d255d9e9c74e9fba084b.patch b/srcpkgs/beignet/patches/e1b2419a0008e38ef2d9d255d9e9c74e9fba084b.patch
deleted file mode 100644
index 8de9e6e2f093..000000000000
--- a/srcpkgs/beignet/patches/e1b2419a0008e38ef2d9d255d9e9c74e9fba084b.patch
+++ /dev/null
@@ -1,134 +0,0 @@
-From e1b2419a0008e38ef2d9d255d9e9c74e9fba084b Mon Sep 17 00:00:00 2001
-From: "Rebecca N. Palmer" <rebecca_palmer@zoho.com>
-Date: Sat, 21 Jul 2018 20:05:54 +0100
-Subject: Add preliminary LLVM 7 support
-
-This is preliminary because LLVM 7 has not been released yet:
-it was tested with the snapshot from Debian experimental (svn336894).
-
-1.Change linking order, as clangCodeGen now links to clangFrontend
-2.Pass references not pointers to WriteBitcodeToFile and CloneModule
-3.Add the headers that LoopSimplifyID, LCSSAID and
-some create*Pass have moved to
-4.Define our DEBUG whether or not we just undefined LLVM's
-(theirs is now LLVM_DEBUG, but we never actually use it)
-
-Signed-off-by: Rebecca N. Palmer <rebecca_palmer@zoho.com>
-Reviewed-by: Yang Rong <rong.r.yang@intel.com>
----
- CMake/FindLLVM.cmake                     | 2 +-
- backend/src/backend/gen_program.cpp      | 8 ++++++++
- backend/src/backend/program.cpp          | 4 ++++
- backend/src/llvm/ExpandLargeIntegers.cpp | 2 +-
- backend/src/llvm/llvm_bitcode_link.cpp   | 4 ++++
- backend/src/llvm/llvm_includes.hpp       | 4 ++++
- 6 files changed, 22 insertions(+), 2 deletions(-)
-
-diff --git a/CMake/FindLLVM.cmake b/CMake/FindLLVM.cmake
-index 5457f24..f882589 100644
---- a/CMake/FindLLVM.cmake
-+++ b/CMake/FindLLVM.cmake
-@@ -113,10 +113,10 @@ macro(add_one_lib name)
- endmacro()
- 
- #Assume clang lib path same as llvm lib path
-+add_one_lib("clangCodeGen")
- add_one_lib("clangFrontend")
- add_one_lib("clangSerialization")
- add_one_lib("clangDriver")
--add_one_lib("clangCodeGen")
- add_one_lib("clangSema")
- add_one_lib("clangStaticAnalyzerFrontend")
- add_one_lib("clangStaticAnalyzerCheckers")
-diff --git a/backend/src/backend/gen_program.cpp b/backend/src/backend/gen_program.cpp
-index 274c99c..4159234 100644
---- a/backend/src/backend/gen_program.cpp
-+++ b/backend/src/backend/gen_program.cpp
-@@ -454,7 +454,11 @@ namespace gbe {
- #ifdef GBE_COMPILER_AVAILABLE
-       std::string str;
-       llvm::raw_string_ostream OS(str);
-+#if LLVM_VERSION_MAJOR >= 7
-+      llvm::WriteBitcodeToFile(*((llvm::Module*)prog->module), OS);
-+#else
-       llvm::WriteBitcodeToFile((llvm::Module*)prog->module, OS);
-+#endif
-       std::string& bin_str = OS.str();
-       int llsz = bin_str.size();
-       *binary = (char *)malloc(sizeof(char) * (llsz+1) );
-@@ -545,7 +549,11 @@ namespace gbe {
-                                     &modRef);
-         src = llvm::unwrap(modRef);
-       }
-+#if LLVM_VERSION_MAJOR >= 7
-+      llvm::Module* clone = llvm::CloneModule(*src).release();
-+#else
-       llvm::Module* clone = llvm::CloneModule(src).release();
-+#endif
-       if (LLVMLinkModules2(wrap(dst), wrap(clone))) {
- #elif LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 37
-       if (LLVMLinkModules(wrap(dst), wrap(src), LLVMLinkerPreserveSource_Removed, &errMsg)) {
-diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
-index c37c595..b36f7b4 100644
---- a/backend/src/backend/program.cpp
-+++ b/backend/src/backend/program.cpp
-@@ -794,7 +794,11 @@ namespace gbe {
-       llvm::raw_fd_ostream ostream (dumpSPIRBinaryName.c_str(),
-                                     err, llvm::sys::fs::F_None);
-       if (!err)
-+#if LLVM_VERSION_MAJOR<7
-         llvm::WriteBitcodeToFile(*out_module, ostream);
-+#else
-+        llvm::WriteBitcodeToFile(**out_module, ostream);
-+#endif
-     }
- #endif
-     return true;
-diff --git a/backend/src/llvm/ExpandLargeIntegers.cpp b/backend/src/llvm/ExpandLargeIntegers.cpp
-index 8515dc1..4aec44e 100644
---- a/backend/src/llvm/ExpandLargeIntegers.cpp
-+++ b/backend/src/llvm/ExpandLargeIntegers.cpp
-@@ -99,8 +99,8 @@ using namespace llvm;
- 
- #ifdef DEBUG
-   #undef DEBUG
--  #define DEBUG(...)
- #endif
-+#define DEBUG(...)
- // Break instructions up into no larger than 64-bit chunks.
- static const unsigned kChunkBits = 64;
- static const unsigned kChunkBytes = kChunkBits / CHAR_BIT;
-diff --git a/backend/src/llvm/llvm_bitcode_link.cpp b/backend/src/llvm/llvm_bitcode_link.cpp
-index ef56e4c..4c3e20e 100644
---- a/backend/src/llvm/llvm_bitcode_link.cpp
-+++ b/backend/src/llvm/llvm_bitcode_link.cpp
-@@ -340,7 +340,11 @@ namespace gbe
-     /* We use beignet's bitcode as dst because it will have a lot of
-        lazy functions which will not be loaded. */
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 39
-+#if LLVM_VERSION_MAJOR >= 7
-+    llvm::Module * linked_module = llvm::CloneModule(*(llvm::Module*)mod).release();
-+#else
-     llvm::Module * linked_module = llvm::CloneModule((llvm::Module*)mod).release();
-+#endif
-     if(LLVMLinkModules2(wrap(clonedLib), wrap(linked_module))) {
- #else
-     char* errorMsg;
-diff --git a/backend/src/llvm/llvm_includes.hpp b/backend/src/llvm/llvm_includes.hpp
-index 184553a..ffccf02 100644
---- a/backend/src/llvm/llvm_includes.hpp
-+++ b/backend/src/llvm/llvm_includes.hpp
-@@ -89,6 +89,10 @@
- #include "llvm/CodeGen/IntrinsicLowering.h"
- 
- #include "llvm/Transforms/Scalar.h"
-+#if LLVM_VERSION_MAJOR >= 7
-+#include "llvm/Transforms/Utils.h"
-+#include "llvm/Transforms/InstCombine/InstCombine.h"
-+#endif
- #include "llvm/MC/MCAsmInfo.h"
- #include "llvm/MC/MCContext.h"
- #include "llvm/MC/MCInstrInfo.h"
--- 
-cgit v1.1
-
diff --git a/srcpkgs/beignet/patches/llvm06.patch b/srcpkgs/beignet/patches/llvm06.patch
deleted file mode 100644
index 3389e66c82df..000000000000
--- a/srcpkgs/beignet/patches/llvm06.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-Source: Arch Linux
-Upstream: unknown
-Reason: fixes llvm6 compilation
-
---- a/backend/src/llvm/llvm_to_gen.cpp	2017-10-24 09:04:48.000000000 +0300
-+++ b/backend/src/llvm/llvm_to_gen.cpp	2018-03-16 16:08:54.669963824 +0200
-@@ -322,7 +322,11 @@ namespace gbe
-     DataLayout DL(&mod);
-     
-     gbeDiagnosticContext dc;
-+#if LLVM_VERSION_MAJOR >= 6
-+    mod.getContext().setDiagnosticHandlerCallBack(&gbeDiagnosticHandler,&dc);
-+#else
-     mod.getContext().setDiagnosticHandler(&gbeDiagnosticHandler,&dc);
-+#endif
- 
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 37
-     mod.setDataLayout(DL);
---- a/backend/src/llvm/llvm_unroll.cpp	2017-10-24 09:04:48.000000000 +0300
-+++ b/backend/src/llvm/llvm_unroll.cpp	2018-03-16 16:09:47.736403557 +0200
-@@ -205,7 +205,9 @@ namespace gbe {
-           if (parentTripCount != 0 && currTripCount * parentTripCount > 32) {
-             //Don't change the unrollID if doesn't force unroll.
-             //setUnrollID(parentL, false);
--#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 38
-+#if LLVM_VERSION_MAJOR >= 6
-+            loopInfo.erase(parentL);
-+#elif LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 38
-             loopInfo.markAsRemoved(parentL);
- #else
-             LPM.deleteLoopFromQueue(parentL);
-Only in Beignet-1.3.2-Source: build
-
diff --git a/srcpkgs/beignet/patches/llvm08.patch b/srcpkgs/beignet/patches/llvm08.patch
deleted file mode 100644
index a0c5e7a7c4f7..000000000000
--- a/srcpkgs/beignet/patches/llvm08.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 75c152599a7c1739e6dadcdb9b377acf7e44d9cf Mon Sep 17 00:00:00 2001
-From: Jan Beich <jbeich@FreeBSD.org>
-Date: Wed, 30 Jan 2019 12:42:34 +0000
-Subject: [PATCH] lang/beignet: unbreak with llvm80
-
-Regressed by https://github.com/llvm/llvm-project/commit/721d95713a9e
-
-unable to load /usr/local/lib/beignet//libgbeinterp.so which is part of the driver, please check!
-ld-elf.so.1: /usr/local/lib/beignet//libgbeinterp.so: Undefined symbol "_ZN4llvm24DisableABIBreakingChecksE"
-
-Regressed by https://github.com/llvm/llvm-project/commit/4a2d58e16acc
-
-backend/src/llvm/llvm_gen_backend.cpp:3076:5: error:
-      unknown type name 'TerminatorInst'
-    TerminatorInst *term = bb->getTerminator();
-    ^
-backend/src/llvm/llvm_gen_backend.cpp:3083:5: error:
-      unknown type name 'TerminatorInst'
-    TerminatorInst *term = bb->getTerminator();
-    ^
-
---- a/backend/src/CMakeLists.txt	2017-09-22 08:05:22 UTC
-+++ b/backend/src/CMakeLists.txt
-@@ -168,6 +168,7 @@ add_dependencies(gbe beignet_bitcode)
- endif (NOT (USE_STANDALONE_GBE_COMPILER STREQUAL "true"))
- 
- add_library(gbeinterp SHARED gbe_bin_interpreter.cpp)
-+target_link_libraries(gbeinterp ${LLVM_MODULE_LIBS})
- 
- if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
-   find_library(TERMINFO NAMES tinfo ncurses)
---- a/backend/src/llvm/llvm_gen_backend.cpp	2017-10-24 06:04:48 UTC
-+++ b/backend/src/llvm/llvm_gen_backend.cpp
-@@ -3073,14 +3073,22 @@ namespace gbe
- 
- 
-   static unsigned getChildNo(BasicBlock *bb) {
-+#if LLVM_VERSION_MAJOR < 8
-     TerminatorInst *term = bb->getTerminator();
-+#else
-+    Instruction *term = bb->getTerminator();
-+#endif
-     return term->getNumSuccessors();
-   }
- 
-   // return NULL if index out-range of children number
-   static BasicBlock *getChildPossible(BasicBlock *bb, unsigned index) {
- 
-+#if LLVM_VERSION_MAJOR < 8
-     TerminatorInst *term = bb->getTerminator();
-+#else
-+    Instruction *term = bb->getTerminator();
-+#endif
-     unsigned childNo = term->getNumSuccessors();
-     BasicBlock *child = NULL;
-     if(index < childNo) {
diff --git a/srcpkgs/beignet/patches/llvm09.patch b/srcpkgs/beignet/patches/llvm09.patch
deleted file mode 100644
index acaeceabb6dd..000000000000
--- a/srcpkgs/beignet/patches/llvm09.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-Source: FreeBSD + q66
-
-Mostly FreeBSD other than FindLLVM.cmake changes.
-Linking against clang-cpp does not work for us.
-
---- a/CMake/FindLLVM.cmake
-+++ b/CMake/FindLLVM.cmake
-@@ -140,6 +140,7 @@ add_one_lib("clangStaticAnalyzerCore")
- add_one_lib("clangAnalysis")
- add_one_lib("clangEdit")
- add_one_lib("clangAST")
-+add_one_lib("clangASTMatchers")
- add_one_lib("clangParse")
- add_one_lib("clangSema")
- add_one_lib("clangLex")
---- a/backend/src/llvm/llvm_intrinsic_lowering.cpp	2017-10-24 06:04:48 UTC
-+++ b/backend/src/llvm/llvm_intrinsic_lowering.cpp
-@@ -77,7 +77,11 @@ namespace gbe {
-         std::vector<Type *> ParamTys;
-         for (Value** I = ArgBegin; I != ArgEnd; ++I)
-           ParamTys.push_back((*I)->getType());
-+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
-+        FunctionCallee FCache = M->getOrInsertFunction(NewFn,
-+#else
-         Constant* FCache = M->getOrInsertFunction(NewFn,
-+#endif
-                                         FunctionType::get(RetTy, ParamTys, false));
- 
-         IRBuilder<> Builder(CI->getParent(), BasicBlock::iterator(CI));
---- a/backend/src/llvm/llvm_sampler_fix.cpp	2017-10-24 06:04:48 UTC
-+++ b/backend/src/llvm/llvm_sampler_fix.cpp
-@@ -82,7 +82,11 @@ namespace gbe {
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
-           Module *M = I->getParent()->getParent()->getParent();
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
-+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
-+          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
-+#else
-           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
-+#endif
- #else
-           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
- #endif
-@@ -124,7 +128,11 @@ namespace gbe {
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
-           Module *M = I->getParent()->getParent()->getParent();
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
-+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
-+          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
-+#else
-           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
-+#endif
- #else
-           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
- #endif
---- a/backend/src/llvm/llvm_profiling.cpp	2017-10-24 06:04:48 UTC
-+++ b/backend/src/llvm/llvm_profiling.cpp
-@@ -163,10 +163,18 @@ namespace gbe
-       // __gen_ocl_store_timestamp(int nth, int type);
-       Value *Args[2] = {ConstantInt::get(intTy, pointNum++), ConstantInt::get(intTy, profilingType)};
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
-+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
-+      builder->CreateCall(module->getOrInsertFunction(
-+#else
-       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
-+#endif
-               "__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
-               IntegerType::getInt32Ty(module->getContext()),
-+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
-+              IntegerType::getInt32Ty(module->getContext())),
-+#else
-               IntegerType::getInt32Ty(module->getContext()))),
-+#endif
-               ArrayRef<Value*>(Args));
- #else
-       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
-@@ -185,10 +193,18 @@ namespace gbe
-     Value *Args2[2] = {profilingBuf, ConstantInt::get(intTy, profilingType)};
- 
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
-+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
-+    builder->CreateCall(module->getOrInsertFunction(
-+#else
-     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
-+#endif
-             "__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
-             ptrTy,
-+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
-+            IntegerType::getInt32Ty(module->getContext())),
-+#else
-             IntegerType::getInt32Ty(module->getContext()))),
-+#endif
-             ArrayRef<Value*>(Args2));
- #else
-     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
---- a/backend/src/llvm/llvm_device_enqueue.cpp	2017-10-24 06:04:48 UTC
-+++ b/backend/src/llvm/llvm_device_enqueue.cpp
-@@ -398,8 +398,13 @@ namespace gbe {
-               std::vector<Type *> ParamTys;
-               for (Value** iter = args.begin(); iter != args.end(); ++iter)
-                 ParamTys.push_back((*iter)->getType());
-+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
-+              CallInst* newCI = builder.CreateCall(mod->getOrInsertFunction(
-+                              "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false)), args);
-+#else
-               CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
-                               "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false))), args);
-+#endif
-               CI->replaceAllUsesWith(newCI);
-               deadInsnSet.insert(CI);
-             }
diff --git a/srcpkgs/beignet/patches/llvm10.patch b/srcpkgs/beignet/patches/llvm10.patch
deleted file mode 100644
index 8aafe48a240d..000000000000
--- a/srcpkgs/beignet/patches/llvm10.patch
+++ /dev/null
@@ -1,347 +0,0 @@
-diff --git CMake/FindLLVM.cmake CMake/FindLLVM.cmake
-index 0a59e47..6e90923 100644
---- a/CMake/FindLLVM.cmake
-+++ b/CMake/FindLLVM.cmake
-@@ -104,28 +104,16 @@ string(REGEX REPLACE " *\n" "" LLVM_SYSTEM_LIBS ${LLVM_SYSTEM_LIBS_ORIG})
- endif (LLVM_SYSTEM_LIBS_ORIG)
- endif (LLVM_VERSION_NODOT VERSION_GREATER 34)
- 
-+#something harmless because whitespace at start is an error
-+set(CLANG_LIBRARIES "-ldl")
- macro(add_one_lib name)
-   FIND_LIBRARY(CLANG_LIB
-     NAMES ${name}
-     PATHS ${LLVM_LIBRARY_DIR} NO_DEFAULT_PATH)
--  set(CLANG_LIBRARIES ${CLANG_LIBRARIES} ${CLANG_LIB})
-+  set(CLANG_LIBRARIES "${CLANG_LIBRARIES} ${CLANG_LIB}")
-+  message(STATUS "clanglibs name ${name} this ${CLANG_LIB} all ${CLANG_LIBRARIES} ")
- 	unset(CLANG_LIB CACHE)
- endmacro()
- 
- #Assume clang lib path same as llvm lib path
--add_one_lib("clangCodeGen")
--add_one_lib("clangFrontend")
--add_one_lib("clangSerialization")
--add_one_lib("clangDriver")
--add_one_lib("clangSema")
--add_one_lib("clangStaticAnalyzerFrontend")
--add_one_lib("clangStaticAnalyzerCheckers")
--add_one_lib("clangStaticAnalyzerCore")
--add_one_lib("clangAnalysis")
--add_one_lib("clangEdit")
--add_one_lib("clangAST")
--add_one_lib("clangASTMatchers")
--add_one_lib("clangParse")
--add_one_lib("clangSema")
--add_one_lib("clangLex")
--add_one_lib("clangBasic")
-+add_one_lib("clang-cpp")
-diff --git CMakeLists.txt CMakeLists.txt
-index c11acbb..08f427d 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -79,7 +79,7 @@ elseif (COMPILER STREQUAL "CLANG")
- elseif (COMPILER STREQUAL "ICC")
-   set (CMAKE_C_CXX_FLAGS "${CMAKE_C_CXX_FLAGS}  -wd2928 -Wall -fPIC -fstrict-aliasing -fp-model fast -msse4.1 -Wl,-E")
- endif ()
--set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_CXX_FLAGS} -std=c++0x -Wno-invalid-offsetof")
-+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_CXX_FLAGS} -Wno-invalid-offsetof")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_CXX_FLAGS}")
- set (CMAKE_CXX_FLAGS_DEBUG          "-O0 -g -DGBE_DEBUG=1")
- set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DGBE_DEBUG=1")
-diff --git backend/src/backend/program.cpp backend/src/backend/program.cpp
-index b36f7b4..e666031 100644
---- a/backend/src/backend/program.cpp
-+++ b/backend/src/backend/program.cpp
-@@ -694,9 +694,9 @@ namespace gbe {
- #endif
-                 );
- 
-+    llvm::cl::ResetAllOptionOccurrences();
-     clang::CompilerInvocation::CreateFromArgs(*CI,
--                                              &args[0],
--                                              &args[0] + args.size(),
-+                                              clang::ArrayRef<const char*>(args),
-                                               Diags);
-     // Create the compiler instance
-     clang::CompilerInstance Clang;
-@@ -1242,8 +1242,7 @@ EXTEND_QUOTE:
-       // Create the compiler invocation
-       std::unique_ptr<clang::CompilerInvocation> CI(new clang::CompilerInvocation);
-       return clang::CompilerInvocation::CreateFromArgs(*CI,
--                                                       &args[0],
--                                                       &args[0] + args.size(),
-+                                                       clang::ArrayRef<const char*>(args),
-                                                        Diags);
-     }
- #endif
-diff --git backend/src/llvm/llvm_gen_backend.cpp backend/src/llvm/llvm_gen_backend.cpp
-index c6fc30d..82441d8 100644
---- a/backend/src/llvm/llvm_gen_backend.cpp
-+++ b/backend/src/llvm/llvm_gen_backend.cpp
-@@ -575,10 +575,12 @@ namespace gbe
-         has_errors(false),
-         legacyMode(true)
-     {
-+#if LLVM_VERSION_MAJOR < 10
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 37
-       initializeLoopInfoWrapperPassPass(*PassRegistry::getPassRegistry());
- #else
-       initializeLoopInfoPass(*PassRegistry::getPassRegistry());
-+#endif
- #endif
-       pass = PASS_EMIT_REGISTERS;
-     }
-diff --git backend/src/llvm/llvm_gen_backend.hpp backend/src/llvm/llvm_gen_backend.hpp
-index b4715b1..8e74f7a 100644
---- a/backend/src/llvm/llvm_gen_backend.hpp
-+++ b/backend/src/llvm/llvm_gen_backend.hpp
-@@ -130,10 +130,10 @@ namespace gbe
-   llvm::FunctionPass *createGenPass(ir::Unit &unit);
- 
-   /*! Remove the GEP instructions */
--  llvm::BasicBlockPass *createRemoveGEPPass(const ir::Unit &unit);
-+  llvm::FunctionPass *createRemoveGEPPass(const ir::Unit &unit);
- 
-   /*! Merge load/store if possible */
--  llvm::BasicBlockPass *createLoadStoreOptimizationPass();
-+  llvm::FunctionPass *createLoadStoreOptimizationPass();
- 
-   /*! Scalarize all vector op instructions */
-   llvm::FunctionPass* createScalarizePass();
-@@ -141,7 +141,7 @@ namespace gbe
-   llvm::ModulePass* createBarrierNodupPass(bool);
- 
-   /*! Convert the Intrinsic call to gen function */
--  llvm::BasicBlockPass *createIntrinsicLoweringPass();
-+  llvm::FunctionPass *createIntrinsicLoweringPass();
- 
-   /*! Passer the printf function call. */
-   llvm::FunctionPass* createPrintfParserPass(ir::Unit &unit);
-diff --git backend/src/llvm/llvm_intrinsic_lowering.cpp backend/src/llvm/llvm_intrinsic_lowering.cpp
-index 94f0ce6..b5539e9 100644
---- a/backend/src/llvm/llvm_intrinsic_lowering.cpp
-+++ b/backend/src/llvm/llvm_intrinsic_lowering.cpp
-@@ -29,12 +29,12 @@
- using namespace llvm;
- 
- namespace gbe {
--    class InstrinsicLowering : public BasicBlockPass
-+    class InstrinsicLowering : public FunctionPass
-     {
-     public:
-       static char ID;
-       InstrinsicLowering() :
--        BasicBlockPass(ID) {}
-+        FunctionPass(ID) {}
- 
-       void getAnalysisUsage(AnalysisUsage &AU) const {
- 
-@@ -93,9 +93,9 @@ namespace gbe {
-         CI->eraseFromParent();
-         return NewCI;
-       }
--      virtual bool runOnBasicBlock(BasicBlock &BB)
-+      virtual bool runOnFunction(Function &F)
-       {
--        bool changedBlock = false;
-+        for (BasicBlock &BB : F) {
-         Module *M = BB.getParent()->getParent();
- 
-         DataLayout TD(M);
-@@ -159,13 +159,14 @@ namespace gbe {
-             }
-           }
-         }
--        return changedBlock;
-+        }
-+        return true;
-       }
-     };
- 
-     char InstrinsicLowering::ID = 0;
- 
--    BasicBlockPass *createIntrinsicLoweringPass() {
-+    FunctionPass *createIntrinsicLoweringPass() {
-       return new InstrinsicLowering();
-     }
- } // end namespace
-diff --git backend/src/llvm/llvm_loadstore_optimization.cpp backend/src/llvm/llvm_loadstore_optimization.cpp
-index 5aa38be..e314302 100644
---- a/backend/src/llvm/llvm_loadstore_optimization.cpp
-+++ b/backend/src/llvm/llvm_loadstore_optimization.cpp
-@@ -26,13 +26,13 @@
- 
- using namespace llvm;
- namespace gbe {
--  class GenLoadStoreOptimization : public BasicBlockPass {
-+  class GenLoadStoreOptimization : public FunctionPass {
- 
-   public:
-     static char ID;
-     ScalarEvolution *SE;
-     const DataLayout *TD;
--    GenLoadStoreOptimization() : BasicBlockPass(ID) {}
-+    GenLoadStoreOptimization() : FunctionPass(ID) {}
- 
-     void getAnalysisUsage(AnalysisUsage &AU) const {
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 38
-@@ -45,7 +45,9 @@ namespace gbe {
-       AU.setPreservesCFG();
-     }
- 
--    virtual bool runOnBasicBlock(BasicBlock &BB) {
-+    virtual bool runOnFunction(Function &F) {
-+        bool changedAnyBlock = false;
-+        for (BasicBlock &BB : F) {
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 38
-       SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
- #else
-@@ -59,7 +61,9 @@ namespace gbe {
-       #else
-         TD = getAnalysisIfAvailable<DataLayout>();
-       #endif
--      return optimizeLoadStore(BB);
-+           changedAnyBlock = optimizeLoadStore(BB) | changedAnyBlock;
-+        }
-+        return changedAnyBlock;
-     }
-     Type    *getValueType(Value *insn);
-     Value   *getPointerOperand(Value *I);
-@@ -148,7 +152,7 @@ namespace gbe {
-       values.push_back(merged[i]);
-     }
-     LoadInst *ld = cast<LoadInst>(merged[0]);
--    unsigned align = ld->getAlignment();
-+    MaybeAlign align = ld->getAlign();
-     unsigned addrSpace = ld->getPointerAddressSpace();
-     // insert before first load
-     Builder.SetInsertPoint(ld);
-@@ -231,7 +235,7 @@ namespace gbe {
- 
-     unsigned addrSpace = st->getPointerAddressSpace();
- 
--    unsigned align = st->getAlignment();
-+    MaybeAlign align = st->getAlign();
-     // insert before the last store
-     Builder.SetInsertPoint(merged[size-1]);
- 
-@@ -325,7 +329,7 @@ namespace gbe {
-     return changed;
-   }
- 
--  BasicBlockPass *createLoadStoreOptimizationPass() {
-+  FunctionPass *createLoadStoreOptimizationPass() {
-     return new GenLoadStoreOptimization();
-   }
- };
-diff --git backend/src/llvm/llvm_passes.cpp backend/src/llvm/llvm_passes.cpp
-index 10752a3..b8f2282 100644
---- a/backend/src/llvm/llvm_passes.cpp
-+++ b/backend/src/llvm/llvm_passes.cpp
-@@ -37,7 +37,7 @@
- #include "sys/map.hpp"
- 
- using namespace llvm;
--
-+template class cfg::Update<BasicBlock *>;
- namespace gbe
- {
-   bool isKernelFunction(const llvm::Function &F) {
-@@ -219,13 +219,13 @@ namespace gbe
-     return offset;
-   }
- 
--  class GenRemoveGEPPasss : public BasicBlockPass
-+  class GenRemoveGEPPasss : public FunctionPass
-   {
- 
-    public:
-     static char ID;
-     GenRemoveGEPPasss(const ir::Unit &unit) :
--      BasicBlockPass(ID),
-+      FunctionPass(ID),
-       unit(unit) {}
-     const ir::Unit &unit;
-     void getAnalysisUsage(AnalysisUsage &AU) const {
-@@ -242,16 +242,18 @@ namespace gbe
- 
-     bool simplifyGEPInstructions(GetElementPtrInst* GEPInst);
- 
--    virtual bool runOnBasicBlock(BasicBlock &BB)
-+    virtual bool runOnFunction(Function &F)
-     {
--      bool changedBlock = false;
-+      bool changedAnyBlock = false;
-+        for (BasicBlock &BB : F) {
-       iplist<Instruction>::iterator I = BB.getInstList().begin();
-       for (auto nextI = I, E = --BB.getInstList().end(); I != E; I = nextI) {
-         iplist<Instruction>::iterator I = nextI++;
-         if(GetElementPtrInst* gep = dyn_cast<GetElementPtrInst>(&*I))
--          changedBlock = (simplifyGEPInstructions(gep) || changedBlock);
-+          changedAnyBlock = (simplifyGEPInstructions(gep) | changedAnyBlock);
-       }
--      return changedBlock;
-+        }
-+      return changedAnyBlock;
-     }
-   };
- 
-@@ -367,7 +369,7 @@ namespace gbe
-     return true;
-   }
- 
--  BasicBlockPass *createRemoveGEPPass(const ir::Unit &unit) {
-+  FunctionPass *createRemoveGEPPass(const ir::Unit &unit) {
-     return new GenRemoveGEPPasss(unit);
-   }
- } /* namespace gbe */
-diff --git backend/src/llvm/llvm_sampler_fix.cpp backend/src/llvm/llvm_sampler_fix.cpp
-index 2a097c8..863be6d 100644
---- a/backend/src/llvm/llvm_sampler_fix.cpp
-+++ b/backend/src/llvm/llvm_sampler_fix.cpp
-@@ -33,10 +33,12 @@ namespace gbe {
-   class SamplerFix : public FunctionPass {
-   public:
-     SamplerFix() : FunctionPass(ID) {
-+#if LLVM_VERSION_MAJOR < 10
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
-       initializeDominatorTreeWrapperPassPass(*PassRegistry::getPassRegistry());
- #else
-       initializeDominatorTreePass(*PassRegistry::getPassRegistry());
-+#endif
- #endif
-     }
- 
-diff --git backend/src/llvm/llvm_scalarize.cpp backend/src/llvm/llvm_scalarize.cpp
-index e9a2a66..e9d2ee4 100644
---- a/backend/src/llvm/llvm_scalarize.cpp
-+++ b/backend/src/llvm/llvm_scalarize.cpp
-@@ -96,10 +96,12 @@ namespace gbe {
- 
-     Scalarize() : FunctionPass(ID)
-     {
-+#if LLVM_VERSION_MAJOR < 10
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
-       initializeDominatorTreeWrapperPassPass(*PassRegistry::getPassRegistry());
- #else
-       initializeDominatorTreePass(*PassRegistry::getPassRegistry());
-+#endif
- #endif
-     }
- 
-diff --git utests/CMakeLists.txt utests/CMakeLists.txt
-index 300d87a..64179c7 100644
---- a/utests/CMakeLists.txt
-+++ b/utests/CMakeLists.txt
-@@ -26,8 +26,8 @@ if (NOT NOT_BUILD_STAND_ALONE_UTEST)
-   # Threads
-   Find_Package(Threads)
- 
--  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_CXX_FLAGS} -std=c++0x -Wno-invalid-offsetof")
--  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_CXX_FLAGS}")
-+  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_CXX_FLAGS} -Wno-invalid-offsetof -ffloat-store -fno-strict-aliasing")
-+  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_CXX_FLAGS} -ffloat-store -fno-strict-aliasing") #compiler_{degrees,radians,function_argument2} use equality comparison of floats, compiler_long_bitcast uses aliasing
-   set (CMAKE_CXX_FLAGS_DEBUG          "-O0 -g -DGBE_DEBUG=1")
-   set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DGBE_DEBUG=1")
-   set (CMAKE_CXX_FLAGS_MINSIZEREL     "-Os -DNDEBUG -DGBE_DEBUG=0")
diff --git a/srcpkgs/beignet/patches/llvm11.patch b/srcpkgs/beignet/patches/llvm11.patch
deleted file mode 100644
index 2c3a4278943c..000000000000
--- a/srcpkgs/beignet/patches/llvm11.patch
+++ /dev/null
@@ -1,937 +0,0 @@
-Source: Snektron
-
-There were a few changes required for LLVM 11:
-* llvm::StringRef requires .str(), implicit conversion was removed
-* llvm::CallSite was removed, but the required methods are available on llvm::CallInst
-* VectorTyID was split into FixedVectorTyID and ScalableVectorTyID, FixedVectorTyID was used
-* CallInst::getCalledValue() was renamed to CallInst::getCalledOperand()
-* Implicit conversion from MaybeAlign to Align was removed, so MaybeAlign::valueOrOne was used instead.
-
---- a/backend/src/llvm/StripAttributes.cpp	2020-11-09 16:48:20.823866112 +0100
-+++ b/backend/src/llvm/StripAttributes.cpp	2020-11-09 19:04:19.641897141 +0100
-@@ -107,9 +107,8 @@
-        BB != E; ++BB) {
-     for (BasicBlock::iterator Inst = BB->begin(), E = BB->end();
-          Inst != E; ++Inst) {
--      CallSite Call(&*Inst);
--      if (Call)
--        Call.setCallingConv(CallingConv::C);
-+      if (CallInst* callInst = dyn_cast<CallInst>(&*Inst))
-+        callInst->setCallingConv(CallingConv::C);
-     }
-   }
-
---- a/backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 16:48:20.823866112 +0100
-+++ b/backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 17:04:09.633753428 +0100
-@@ -98,7 +98,7 @@
-         if (callFunc && callFunc->getIntrinsicID() != 0)
-           continue;
-
--        std::string fnName = call->getCalledValue()->stripPointerCasts()->getName();
-+        std::string fnName = call->getCalledOperand()->stripPointerCasts()->getName().str();
-
-         if (!MFS.insert(fnName).second) {
-           continue;
---- a/backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 16:48:20.823866112 +0100
-+++ b/backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 19:01:49.201915008 +0100
-@@ -45,7 +45,7 @@
-       return NULL;
-
-     /* This is a fake, to check the function bitcast is for block or not */
--    std::string fnName = Fn->getName();
-+    std::string fnName = Fn->getName().str();
-     if(fnName.find("_invoke") == std::string::npos)
-       return NULL;
-
-@@ -119,18 +119,18 @@
-       ParamTys.push_back(ty);
-     }
-     FunctionType* NewFT = FunctionType::get(Fn->getReturnType(), ParamTys, false);
--    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName());
-+    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName().str());
-     SmallVector<ReturnInst*, 8> Returns;
-
-     Function::arg_iterator NewFnArgIt = NewFn->arg_begin();
-     for (Function::arg_iterator I = Fn->arg_begin(), E = Fn->arg_end(); I != E; ++I) {
--      std::string ArgName = I->getName();
-+      std::string ArgName = I->getName().str();
-       NewFnArgIt->setName(ArgName);
-       VMap[&*I] = &(*NewFnArgIt++);
-     }
-     CloneFunctionInto(NewFn, Fn, VMap, /*ModuleLevelChanges=*/true, Returns);
-
--    Fn->setName("__d" + Fn->getName());
-+    Fn->setName("__d" + Fn->getName().str());
-     mod->getFunctionList().push_back(NewFn);
-     //mod->getOrInsertFunction(NewFn->getName(), NewFn->getFunctionType(),
-     //                         NewFn->getAttributes());
-@@ -147,7 +147,7 @@
-       argTypeNames.push_back(llvm::MDString::get(Context, "char*"));
-       argBaseTypeNames.push_back(llvm::MDString::get(Context, "char*"));
-       argTypeQuals.push_back(llvm::MDString::get(Context, ""));
--      argNames.push_back(llvm::MDString::get(Context, I->getName()));
-+      argNames.push_back(llvm::MDString::get(Context, I->getName().str()));
-     }
-
-     //If run to here, llvm version always > 3.9, add the version check just for build.
-@@ -198,7 +198,7 @@
-            * invoke pointer to store the index in the unit's block functions index.*/
-           Function *Fn = dyn_cast<Function>(bt->getOperand(0));
-
--          std::string fnName = Fn->getName();
-+          std::string fnName = Fn->getName().str();
-           int index = -1;
-           for(size_t i=0; i<unit.blockFuncs.size(); i++) {
-             if(unit.blockFuncs[i] == fnName) {
-@@ -241,7 +241,7 @@
-             //unnamed call function, parse the use to find the define of called function
-             SmallVector<Value*, 16> args(CI->op_begin(), CI->op_end()-1);
-
--            Value *v = CI->getCalledValue();
-+            Value *v = CI->getCalledOperand();
-             BitCastInst* bt = dyn_cast<BitCastInst>(v);
-             if(bt == NULL)
-               continue;
-@@ -316,7 +316,7 @@
-                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
-                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
-                   Function* f = dyn_cast<Function>(bt->getOperand(0));
--                  blocks[v] = f->getName();
-+                  blocks[v] = f->getName().str();
-                 }
-               }
-
-@@ -332,7 +332,7 @@
-           } else {
-             //handle enqueue_kernel function call
-             Function *fn = CI->getCalledFunction();
--            if (fn->getName().find("enqueue_kernel") == std::string::npos)
-+            if (fn->getName().str().find("enqueue_kernel") == std::string::npos)
-               continue;
-
-             //block parameter's index, 3 or 6
-@@ -361,7 +361,7 @@
-                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
-                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
-                   Function* f = dyn_cast<Function>(bt->getOperand(0));
--                  blocks[v] = f->getName();
-+                  blocks[v] = f->getName().str();
-                 }
-               }
-             } else if(isa<AllocaInst>(block)) {
---- a/backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 16:48:20.823866112 +0100
-+++ b/backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 18:33:50.919114327 +0100
-@@ -376,7 +376,7 @@
-           GBE_ASSERT(index == 0);
-           return this->_newScalar(value, key, type, index, uniform);
-           break;
--        case Type::VectorTyID:
-+        case Type::FixedVectorTyID:
-         {
-           auto vectorType = cast<VectorType>(type);
-           auto elementType = vectorType->getElementType();
-@@ -743,20 +743,20 @@
- #undef DECL_VISIT_FN
-
-     // Emit rounding instructions from gen native function
--    void emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode);
-+    void emitRoundingCallInst(CallInst &I, ir::Opcode opcode);
-     // Emit unary instructions from gen native function
--    void emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
-+    void emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
-     // Emit unary instructions from gen native function
--    void emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode);
-+    void emitAtomicInst(CallInst &I, ir::AtomicOps opcode);
-     // Emit workgroup instructions
--    void emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
-+    void emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode);
-     // Emit subgroup instructions
--    void emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
-+    void emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode);
-     // Emit subgroup instructions
--    void emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
--    void emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
-+    void emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
-+    void emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
-
--    uint8_t appendSampler(CallSite::arg_iterator AI);
-+    uint8_t appendSampler(User::op_iterator AI);
-     uint8_t getImageID(CallInst &I);
-
-     // These instructions are not supported at all
-@@ -1320,13 +1320,13 @@
- #endif
-
-       if(typeNameNode) {
--        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
-+        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
-       }
-       if(typeBaseNameNode) {
--        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
-+        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
-       }
--      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
--      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
-+      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
-+      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
-       bool isImage = llvmInfo.isImageType();
-       bool isPipe = llvmInfo.isPipeType();
-       if (I->getType()->isPointerTy() || isImage || isPipe) {
-@@ -1531,7 +1531,7 @@
-             EltTy = getEltType(EltTy, TypeIndex);
-         }
-
--        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName());
-+        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName().str());
-         unsigned int defOffset = cc.getOffset();
-         relocs.push_back(ir::RelocEntry(offset, defOffset + constantOffset));
-
-@@ -1546,7 +1546,7 @@
-       return;
-     }
-     if (isa<GlobalVariable>(c)) {
--      ir::Constant cc = unit.getConstantSet().getConstant(c->getName());
-+      ir::Constant cc = unit.getConstantSet().getConstant(c->getName().str());
-       unsigned int defOffset = cc.getOffset();
-
-       relocs.push_back(ir::RelocEntry(offset, defOffset));
-@@ -1609,7 +1609,7 @@
-           }
-           break;
-         }
--      case Type::TypeID::VectorTyID:
-+      case Type::TypeID::FixedVectorTyID:
-         {
-           const ConstantDataSequential *cds = dyn_cast<ConstantDataSequential>(c);
-           const VectorType *vecTy = cast<VectorType>(type);
-@@ -1936,7 +1936,7 @@
-       case Type::PointerTyID:
-         regTranslator.newScalar(value, key, 0, uniform);
-         break;
--      case Type::VectorTyID:
-+      case Type::FixedVectorTyID:
-       {
-         auto vectorType = cast<VectorType>(type);
-         const uint32_t elemNum = vectorType->getNumElements();
-@@ -2395,7 +2395,7 @@
- #endif
-         }
-         if(typeNameNode) {
--          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
-+          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
-           //LLVM 3.9 image's type name include access qual, don't match OpenCL spec, erase them.
-           std::vector<std::string> filters = {"__read_only ", "__write_only "};
-           for (uint32_t i = 0; i < filters.size(); i++) {
-@@ -2406,16 +2406,16 @@
-           }
-         }
-         if(typeBaseNameNode){
--          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
-+          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
-         }
-         if(accessQualNode) {
--          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString();
-+          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString().str();
-         }
-         if(typeQualNode) {
--          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
-+          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
-         }
-         if(argNameNode){
--          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString();
-+          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString().str();
-         }
-
-         // function arguments are uniform values.
-@@ -3010,7 +3010,7 @@
-         } else {
-           this->newRegister(const_cast<GlobalVariable*>(&v));
-           ir::Register reg = regTranslator.getScalar(const_cast<GlobalVariable*>(&v), 0);
--          ir::Constant &con = unit.getConstantSet().getConstant(v.getName());
-+          ir::Constant &con = unit.getConstantSet().getConstant(v.getName().str());
-           if (!legacyMode) {
-             ir::Register regload = ctx.reg(getFamily(getType(ctx, v.getType())));
-             ctx.LOADI(getType(ctx, v.getType()), regload, ctx.newIntegerImmediate(con.getOffset(), getType(ctx, v.getType())));
-@@ -3212,7 +3212,7 @@
-         GBE_ASSERTM(false, "Unsupported calling convention");
-     }
-
--    ctx.startFunction(F.getName());
-+    ctx.startFunction(F.getName().str());
-
-     ir::Function &fn = ctx.getFunction();
-     this->regTranslator.clear();
-@@ -3810,9 +3810,9 @@
-
-   void GenWriter::regAllocateCallInst(CallInst &I) {
-     Value *dst = &I;
--    Value *Callee = I.getCalledValue();
-+    Value *Callee = I.getCalledOperand();
-     GBE_ASSERT(ctx.getFunction().getProfile() == ir::PROFILE_OCL);
--    GBE_ASSERT(isa<InlineAsm>(I.getCalledValue()) == false);
-+    GBE_ASSERT(isa<InlineAsm>(I.getCalledOperand()) == false);
-     if(I.getNumArgOperands()) GBE_ASSERT(I.hasStructRetAttr() == false);
-
-     // We only support a small number of intrinsics right now
-@@ -3870,7 +3870,7 @@
-       }
-     }
-     // Get the name of the called function and handle it
--    const std::string fnName = Callee->stripPointerCasts()->getName();
-+    const std::string fnName = Callee->stripPointerCasts()->getName().str();
-     auto genIntrinsicID = intrinsicMap.find(fnName);
-     switch (genIntrinsicID) {
-       case GEN_OCL_GET_GROUP_ID0:
-@@ -4166,7 +4166,7 @@
-     };
-   }
-
--  void GenWriter::emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode) {
-+  void GenWriter::emitRoundingCallInst(CallInst &I, ir::Opcode opcode) {
-     if (I.getType()->isHalfTy()) {
-       const ir::Register src = this->getRegister(I.getOperand(0));
-       const ir::Register srcFloat = ctx.reg(ir::FAMILY_DWORD);
-@@ -4177,14 +4177,14 @@
-       ctx.F32TO16(ir::TYPE_U16, ir::TYPE_FLOAT, dst, dstFloat);
-     } else {
-       GBE_ASSERT(I.getType()->isFloatTy());
--      this->emitUnaryCallInst(I,CS,opcode);
-+      this->emitUnaryCallInst(I,opcode);
-     }
-   }
-
--  void GenWriter::emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type type) {
--    CallSite::arg_iterator AI = CS.arg_begin();
-+  void GenWriter::emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type type) {
-+    User::op_iterator AI = I.arg_begin();
- #if GBE_DEBUG
--    CallSite::arg_iterator AE = CS.arg_end();
-+    User::op_iterator AE = I.arg_end();
- #endif /* GBE_DEBUG */
-     GBE_ASSERT(AI != AE);
-     const ir::Register src = this->getRegister(*AI);
-@@ -4293,9 +4293,9 @@
-     this->emitAtomicInstHelper(opcode, type, dst, llvmPtr, payloadTuple);
-   }
-
--  void GenWriter::emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode) {
--    CallSite::arg_iterator AI = CS.arg_begin();
--    CallSite::arg_iterator AE = CS.arg_end();
-+  void GenWriter::emitAtomicInst(CallInst &I, ir::AtomicOps opcode) {
-+    User::op_iterator AI = I.arg_begin();
-+    User::op_iterator AE = I.arg_end();
-     GBE_ASSERT(AI != AE);
-     Value *llvmPtr = *AI;
-     ir::AddressSpace addrSpace = addressSpaceLLVMToGen(llvmPtr->getType()->getPointerAddressSpace());
-@@ -4348,7 +4348,7 @@
-     }
-   }
-
--  void GenWriter::emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
-+  void GenWriter::emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
-     ir::Function &f = ctx.getFunction();
-
-     if (f.getwgBroadcastSLM() < 0 && opcode == ir::WORKGROUP_OP_BROADCAST) {
-@@ -4378,8 +4378,8 @@
-       GBE_ASSERT(f.gettidMapSLM() >= 0);
-     }
-
--    CallSite::arg_iterator AI = CS.arg_begin();
--    CallSite::arg_iterator AE = CS.arg_end();
-+    User::op_iterator AI = I.arg_begin();
-+    User::op_iterator AE = I.arg_end();
-     GBE_ASSERT(AI != AE);
-
-     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
-@@ -4391,14 +4391,14 @@
-       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 3);
-       ctx.WORKGROUP(opcode, (uint32_t)f.gettidMapSLM(), getRegister(&I), srcTuple, 3, ir::TYPE_S32);
-     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
--      int argNum = CS.arg_size();
-+      int argNum = I.arg_size();
-       std::vector<ir::Register> src(argNum);
-       for (int i = 0; i < argNum; i++) {
-         src[i] = this->getRegister(*(AI++));
-       }
-       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
-       ctx.WORKGROUP(ir::WORKGROUP_OP_BROADCAST, (uint32_t)f.getwgBroadcastSLM(), getRegister(&I), srcTuple, argNum,
--          getType(ctx, (*CS.arg_begin())->getType()));
-+          getType(ctx, (*I.arg_begin())->getType()));
-     } else {
-       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
-       GBE_ASSERT(sign);
-@@ -4423,9 +4423,9 @@
-     GBE_ASSERT(AI == AE);
-   }
-
--  void GenWriter::emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
--    CallSite::arg_iterator AI = CS.arg_begin();
--    CallSite::arg_iterator AE = CS.arg_end();
-+  void GenWriter::emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
-+    User::op_iterator AI = I.arg_begin();
-+    User::op_iterator AE = I.arg_end();
-     GBE_ASSERT(AI != AE);
-
-     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
-@@ -4435,7 +4435,7 @@
-       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 1);
-       ctx.SUBGROUP(opcode, getRegister(&I), srcTuple, 1, ir::TYPE_S32);
-     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
--      int argNum = CS.arg_size();
-+      int argNum = I.arg_size();
-       GBE_ASSERT(argNum == 2);
-       std::vector<ir::Register> src(argNum);
-       for (int i = 0; i < argNum; i++) {
-@@ -4443,7 +4443,7 @@
-       }
-       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
-       ctx.SUBGROUP(ir::WORKGROUP_OP_BROADCAST, getRegister(&I), srcTuple, argNum,
--          getType(ctx, (*CS.arg_begin())->getType()));
-+          getType(ctx, (*I.arg_begin())->getType()));
-     } else {
-       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
-       GBE_ASSERT(sign);
-@@ -4466,9 +4466,9 @@
-     GBE_ASSERT(AI == AE);
-   }
-
--  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
--    CallSite::arg_iterator AI = CS.arg_begin();
--    CallSite::arg_iterator AE = CS.arg_end();
-+  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
-+    User::op_iterator AI = I.arg_begin();
-+    User::op_iterator AE = I.arg_end();
-     GBE_ASSERT(AI != AE);
-
-     Value *llvmPtr = *(AI++);
-@@ -4522,9 +4522,9 @@
-     GBE_ASSERT(AI == AE);
-   }
-
--  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
--    CallSite::arg_iterator AI = CS.arg_begin();
--    CallSite::arg_iterator AE = CS.arg_end();
-+  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
-+    User::op_iterator AI = I.arg_begin();
-+    User::op_iterator AE = I.arg_end();
-     GBE_ASSERT(AI != AE);
-
-     const uint8_t imageID = getImageID(I);
-@@ -4557,7 +4557,7 @@
-
-   /* append a new sampler. should be called before any reference to
-    * a sampler_t value. */
--  uint8_t GenWriter::appendSampler(CallSite::arg_iterator AI) {
-+  uint8_t GenWriter::appendSampler(User::op_iterator AI) {
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
-     CallInst *TC = dyn_cast<CallInst>(*AI);
-     Constant *CPV = TC ? dyn_cast<Constant>(TC->getOperand(0)) : NULL;
-@@ -4595,10 +4595,9 @@
-         const ir::Function &fn = ctx.getFunction();
-
-         // Get the function arguments
--        CallSite CS(&I);
--        CallSite::arg_iterator AI = CS.arg_begin();
-+        User::op_iterator AI = I.arg_begin();
- #if GBE_DEBUG
--        CallSite::arg_iterator AE = CS.arg_end();
-+        User::op_iterator AE = I.arg_end();
- #endif /* GBE_DEBUG */
-         switch (F->getIntrinsicID()) {
-           case Intrinsic::stacksave:
-@@ -4764,17 +4763,17 @@
-             ctx.MAD(srcType, dst, src0, src1, src2);
-           }
-           break;
--          case Intrinsic::sqrt: this->emitUnaryCallInst(I,CS,ir::OP_SQR); break;
--          case Intrinsic::ceil: this->emitRoundingCallInst(I,CS,ir::OP_RNDU); break;
--          case Intrinsic::trunc: this->emitRoundingCallInst(I,CS,ir::OP_RNDZ); break;
--          case Intrinsic::rint: this->emitRoundingCallInst(I,CS,ir::OP_RNDE); break;
--          case Intrinsic::floor: this->emitRoundingCallInst(I,CS,ir::OP_RNDD); break;
--          case Intrinsic::sin: this->emitUnaryCallInst(I,CS,ir::OP_SIN); break;
--          case Intrinsic::cos: this->emitUnaryCallInst(I,CS,ir::OP_COS); break;
--          case Intrinsic::log2: this->emitUnaryCallInst(I,CS,ir::OP_LOG); break;
--          case Intrinsic::exp2: this->emitUnaryCallInst(I,CS,ir::OP_EXP); break;
-+          case Intrinsic::sqrt: this->emitUnaryCallInst(I,ir::OP_SQR); break;
-+          case Intrinsic::ceil: this->emitRoundingCallInst(I,ir::OP_RNDU); break;
-+          case Intrinsic::trunc: this->emitRoundingCallInst(I,ir::OP_RNDZ); break;
-+          case Intrinsic::rint: this->emitRoundingCallInst(I,ir::OP_RNDE); break;
-+          case Intrinsic::floor: this->emitRoundingCallInst(I,ir::OP_RNDD); break;
-+          case Intrinsic::sin: this->emitUnaryCallInst(I,ir::OP_SIN); break;
-+          case Intrinsic::cos: this->emitUnaryCallInst(I,ir::OP_COS); break;
-+          case Intrinsic::log2: this->emitUnaryCallInst(I,ir::OP_LOG); break;
-+          case Intrinsic::exp2: this->emitUnaryCallInst(I,ir::OP_EXP); break;
-           case Intrinsic::bswap:
--            this->emitUnaryCallInst(I,CS,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
-+            this->emitUnaryCallInst(I,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
-           case Intrinsic::pow:
-           {
-             const ir::Register src0 = this->getRegister(*AI); ++AI;
-@@ -4794,21 +4793,20 @@
-         }
-       } else {
-         // Get the name of the called function and handle it
--        Value *Callee = I.getCalledValue();
--        const std::string fnName = Callee->stripPointerCasts()->getName();
-+        Value *Callee = I.getCalledOperand();
-+        const std::string fnName = Callee->stripPointerCasts()->getName().str();
-         auto genIntrinsicID = intrinsicMap.find(fnName);
-
-         // Get the function arguments
--        CallSite CS(&I);
--        CallSite::arg_iterator AI = CS.arg_begin();
-+        User::op_iterator AI = I.arg_begin();
- #if GBE_DEBUG
--        CallSite::arg_iterator AE = CS.arg_end();
-+        User::op_iterator AE = I.arg_end();
- #endif /* GBE_DEBUG */
-
-         switch (genIntrinsicID) {
--          case GEN_OCL_FBH: this->emitUnaryCallInst(I,CS,ir::OP_FBH, ir::TYPE_U32); break;
--          case GEN_OCL_FBL: this->emitUnaryCallInst(I,CS,ir::OP_FBL, ir::TYPE_U32); break;
--          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,CS,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
-+          case GEN_OCL_FBH: this->emitUnaryCallInst(I,ir::OP_FBH, ir::TYPE_U32); break;
-+          case GEN_OCL_FBL: this->emitUnaryCallInst(I,ir::OP_FBL, ir::TYPE_U32); break;
-+          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
-           case GEN_OCL_ABS:
-           {
-             const ir::Register src = this->getRegister(*AI);
-@@ -4915,8 +4913,8 @@
-             ctx.REGION(dst, src, x.getIntegerValue());
-             break;
-           }
--          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,CS,ir::OP_RSQ); break;
--          case GEN_OCL_RCP: this->emitUnaryCallInst(I,CS,ir::OP_RCP); break;
-+          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,ir::OP_RSQ); break;
-+          case GEN_OCL_RCP: this->emitUnaryCallInst(I,ir::OP_RCP); break;
-           case GEN_OCL_FORCE_SIMD8: ctx.setSimdWidth(8); break;
-           case GEN_OCL_FORCE_SIMD16: ctx.setSimdWidth(16); break;
-           case GEN_OCL_LBARRIER: ctx.SYNC(ir::syncLocalBarrier); break;
-@@ -4947,31 +4945,31 @@
-             break;
-           }
-           case GEN_OCL_ATOMIC_ADD0:
--          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_ADD); break;
-+          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,ir::ATOMIC_OP_ADD); break;
-           case GEN_OCL_ATOMIC_SUB0:
--          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_SUB); break;
-+          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,ir::ATOMIC_OP_SUB); break;
-           case GEN_OCL_ATOMIC_AND0:
--          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_AND); break;
-+          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,ir::ATOMIC_OP_AND); break;
-           case GEN_OCL_ATOMIC_OR0:
--          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_OR); break;
-+          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,ir::ATOMIC_OP_OR); break;
-           case GEN_OCL_ATOMIC_XOR0:
--          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XOR); break;
-+          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,ir::ATOMIC_OP_XOR); break;
-           case GEN_OCL_ATOMIC_XCHG0:
--          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XCHG); break;
-+          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_XCHG); break;
-           case GEN_OCL_ATOMIC_INC0:
--          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_INC); break;
-+          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,ir::ATOMIC_OP_INC); break;
-           case GEN_OCL_ATOMIC_DEC0:
--          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_DEC); break;
-+          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,ir::ATOMIC_OP_DEC); break;
-           case GEN_OCL_ATOMIC_UMIN0:
--          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMIN); break;
-+          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMIN); break;
-           case GEN_OCL_ATOMIC_UMAX0:
--          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMAX); break;
-+          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMAX); break;
-           case GEN_OCL_ATOMIC_IMIN0:
--          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMIN); break;
-+          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMIN); break;
-           case GEN_OCL_ATOMIC_IMAX0:
--          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMAX); break;
-+          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMAX); break;
-           case GEN_OCL_ATOMIC_CMPXCHG0:
--          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_CMPXCHG); break;
-+          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_CMPXCHG); break;
-           case GEN_OCL_GET_IMAGE_WIDTH:
-           case GEN_OCL_GET_IMAGE_HEIGHT:
-           case GEN_OCL_GET_IMAGE_DEPTH:
-@@ -5429,48 +5427,48 @@
-             ctx.WAIT();
-             break;
-           }
--          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ALL); break;
--          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ANY); break;
-+          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ALL); break;
-+          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ANY); break;
-           case GEN_OCL_WORK_GROUP_BROADCAST:
--            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
-+            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
-           case GEN_OCL_WORK_GROUP_REDUCE_ADD:
--            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
-+            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
-           case GEN_OCL_WORK_GROUP_REDUCE_MAX:
--            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
-+            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
-           case GEN_OCL_WORK_GROUP_REDUCE_MIN:
--            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
-+            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
-           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_ADD:
--            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
-+            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
-           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MAX:
--            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
-+            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
-           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MIN:
--            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
-+            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
-           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_ADD:
--            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
-+            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
-           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MAX:
--            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
-+            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
-           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MIN:
--            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
-+            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
-           case GEN_OCL_SUB_GROUP_BROADCAST:
--            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
-+            this->emitSubGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
-           case GEN_OCL_SUB_GROUP_REDUCE_ADD:
--            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
-+            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
-           case GEN_OCL_SUB_GROUP_REDUCE_MAX:
--            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
-+            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
-           case GEN_OCL_SUB_GROUP_REDUCE_MIN:
--            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
-+            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
-           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_ADD:
--            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
-+            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
-           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MAX:
--            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
-+            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
-           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MIN:
--            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
-+            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
-           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_ADD:
--            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
-+            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
-           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MAX:
--            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
-+            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
-           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MIN:
--            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
-+            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
-           case GEN_OCL_LRP:
-           {
-             const ir::Register dst  = this->getRegister(&I);
-@@ -5484,69 +5482,69 @@
-             break;
-           }
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM:
--            this->emitBlockReadWriteMemInst(I, CS, false, 1); break;
-+            this->emitBlockReadWriteMemInst(I, false, 1); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM2:
--            this->emitBlockReadWriteMemInst(I, CS, false, 2); break;
-+            this->emitBlockReadWriteMemInst(I, false, 2); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM4:
--            this->emitBlockReadWriteMemInst(I, CS, false, 4); break;
-+            this->emitBlockReadWriteMemInst(I, false, 4); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM8:
--            this->emitBlockReadWriteMemInst(I, CS, false, 8); break;
-+            this->emitBlockReadWriteMemInst(I, false, 8); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM:
--            this->emitBlockReadWriteMemInst(I, CS, true, 1); break;
-+            this->emitBlockReadWriteMemInst(I, true, 1); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM2:
--            this->emitBlockReadWriteMemInst(I, CS, true, 2); break;
-+            this->emitBlockReadWriteMemInst(I, true, 2); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM4:
--            this->emitBlockReadWriteMemInst(I, CS, true, 4); break;
-+            this->emitBlockReadWriteMemInst(I, true, 4); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM8:
--            this->emitBlockReadWriteMemInst(I, CS, true, 8); break;
-+            this->emitBlockReadWriteMemInst(I, true, 8); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE:
--            this->emitBlockReadWriteImageInst(I, CS, false, 1); break;
-+            this->emitBlockReadWriteImageInst(I, false, 1); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE2:
--            this->emitBlockReadWriteImageInst(I, CS, false, 2); break;
-+            this->emitBlockReadWriteImageInst(I, false, 2); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE4:
--            this->emitBlockReadWriteImageInst(I, CS, false, 4); break;
-+            this->emitBlockReadWriteImageInst(I, false, 4); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE8:
--            this->emitBlockReadWriteImageInst(I, CS, false, 8); break;
-+            this->emitBlockReadWriteImageInst(I, false, 8); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE:
--            this->emitBlockReadWriteImageInst(I, CS, true, 1); break;
-+            this->emitBlockReadWriteImageInst(I, true, 1); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE2:
--            this->emitBlockReadWriteImageInst(I, CS, true, 2); break;
-+            this->emitBlockReadWriteImageInst(I, true, 2); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE4:
--            this->emitBlockReadWriteImageInst(I, CS, true, 4); break;
-+            this->emitBlockReadWriteImageInst(I, true, 4); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE8:
--            this->emitBlockReadWriteImageInst(I, CS, true, 8); break;
-+            this->emitBlockReadWriteImageInst(I, true, 8); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM:
--            this->emitBlockReadWriteMemInst(I, CS, false, 1, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteMemInst(I, false, 1, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM2:
--            this->emitBlockReadWriteMemInst(I, CS, false, 2, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteMemInst(I, false, 2, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM4:
--            this->emitBlockReadWriteMemInst(I, CS, false, 4, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteMemInst(I, false, 4, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM8:
--            this->emitBlockReadWriteMemInst(I, CS, false, 8, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteMemInst(I, false, 8, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM:
--            this->emitBlockReadWriteMemInst(I, CS, true, 1, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteMemInst(I, true, 1, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM2:
--            this->emitBlockReadWriteMemInst(I, CS, true, 2, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteMemInst(I, true, 2, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM4:
--            this->emitBlockReadWriteMemInst(I, CS, true, 4, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteMemInst(I, true, 4, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM8:
--            this->emitBlockReadWriteMemInst(I, CS, true, 8, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteMemInst(I, true, 8, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE:
--            this->emitBlockReadWriteImageInst(I, CS, false, 1, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteImageInst(I, false, 1, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE2:
--            this->emitBlockReadWriteImageInst(I, CS, false, 2, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteImageInst(I, false, 2, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE4:
--            this->emitBlockReadWriteImageInst(I, CS, false, 4, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteImageInst(I, false, 4, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE8:
--            this->emitBlockReadWriteImageInst(I, CS, false, 8, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteImageInst(I, false, 8, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE:
--            this->emitBlockReadWriteImageInst(I, CS, true, 1, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteImageInst(I, true, 1, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE2:
--            this->emitBlockReadWriteImageInst(I, CS, true, 2, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteImageInst(I, true, 2, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE4:
--            this->emitBlockReadWriteImageInst(I, CS, true, 4, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteImageInst(I, true, 4, ir::TYPE_U16); break;
-           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE8:
--            this->emitBlockReadWriteImageInst(I, CS, true, 8, ir::TYPE_U16); break;
-+            this->emitBlockReadWriteImageInst(I, true, 8, ir::TYPE_U16); break;
-           case GEN_OCL_GET_PIPE:
-           case GEN_OCL_MAKE_RID:
-           case GEN_OCL_GET_RID:
---- a/backend/src/llvm/llvm_includes.hpp	2020-11-09 16:48:20.823866112 +0100
-+++ b/backend/src/llvm/llvm_includes.hpp	2020-11-09 19:00:09.955926795 +0100
-@@ -103,7 +103,6 @@
-
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
- #include "llvm/IR/Mangler.h"
--#include "llvm/IR/CallSite.h"
- #include "llvm/IR/CFG.h"
- #include "llvm/IR/InstVisitor.h"
- #include "llvm/IR/IRPrintingPasses.h"
---- a/backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 16:48:20.823866112 +0100
-+++ b/backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 19:10:37.141852308 +0100
-@@ -160,7 +160,7 @@
-     Value *vecPtr = Builder.CreateBitCast(ld->getPointerOperand(),
-                                         PointerType::get(vecTy, addrSpace));
-     LoadInst *vecValue = Builder.CreateLoad(vecPtr);
--    vecValue->setAlignment(align);
-+    vecValue->setAlignment(align.valueOrOne());
-
-     for (unsigned i = 0; i < size; ++i) {
-       Value *S = Builder.CreateExtractElement(vecValue, Builder.getInt32(i));
-@@ -251,7 +251,7 @@
-       return;
-     Value *newPtr = Builder.CreateBitCast(stPointer, PointerType::get(vecTy, addrSpace));
-     StoreInst *newST = Builder.CreateStore(parent, newPtr);
--    newST->setAlignment(align);
-+    newST->setAlignment(align.valueOrOne());
-   }
-
-   // Find the safe iterator we can point to. If reorder happens, we need to
---- a/backend/src/llvm/llvm_passes.cpp	2020-11-09 16:48:20.823866112 +0100
-+++ b/backend/src/llvm/llvm_passes.cpp	2020-11-09 18:48:55.997006837 +0100
-@@ -95,7 +95,7 @@
-   {
-     switch (Ty->getTypeID()) {
-       case Type::VoidTyID: NOT_SUPPORTED;
--      case Type::VectorTyID:
-+      case Type::FixedVectorTyID:
-       {
-         const VectorType* VecTy = cast<VectorType>(Ty);
-         uint32_t elemNum = VecTy->getNumElements();
-@@ -138,7 +138,7 @@
-       case Type::HalfTyID:    return 16;
-       case Type::FloatTyID:   return 32;
-       case Type::DoubleTyID:  return 64;
--      case Type::VectorTyID:
-+      case Type::FixedVectorTyID:
-       {
-         const VectorType* VecTy = cast<VectorType>(Ty);
-         uint32_t numElem = VecTy->getNumElements();
-@@ -184,10 +184,12 @@
-     Type *elementType = NULL;
-     if (PointerType* ptrType = dyn_cast<PointerType>(eltTy))
-       elementType = ptrType->getElementType();
--    else if(SequentialType * seqType = dyn_cast<SequentialType>(eltTy))
--      elementType = seqType->getElementType();
--    else if(CompositeType * compTy= dyn_cast<CompositeType>(eltTy))
--      elementType = compTy->getTypeAtIndex(index);
-+    else if (ArrayType * arrType = dyn_cast<ArrayType>(eltTy))
-+      elementType = arrType->getElementType();
-+    else if(VectorType * vecType = dyn_cast<VectorType>(eltTy))
-+      elementType = vecType->getElementType();
-+    else if(StructType * structType = dyn_cast<StructType>(eltTy))
-+      elementType = structType->getTypeAtIndex(index);
-     GBE_ASSERT(elementType);
-     return elementType;
-   }
---- a/backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 16:48:20.823866112 +0100
-+++ b/backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 18:57:52.618943105 +0100
-@@ -323,8 +323,7 @@
-
-   bool PrintfParser::parseOnePrintfInstruction(CallInst * call)
-   {
--    CallSite CS(call);
--    CallSite::arg_iterator CI_FMT = CS.arg_begin();
-+    User::op_iterator CI_FMT = call->arg_begin();
-     int param_num = 0;
-
-     llvm::Constant* arg0 = dyn_cast<llvm::ConstantExpr>(*CI_FMT);
-@@ -341,7 +340,7 @@
-       return false;
-     }
-
--    std::string fmt = fmt_arg->getAsCString();
-+    std::string fmt = fmt_arg->getAsCString().str();
-     if (fmt.size() == 0)
-       return false;
-
-@@ -437,8 +436,8 @@
-         if ( callFunc->getIntrinsicID() != 0)
-           continue;
-
--        Value *Callee = call->getCalledValue();
--        const std::string fnName = Callee->getName();
-+        Value *Callee = call->getCalledOperand();
-+        const std::string fnName = Callee->getName().str();
-
-         if (fnName != "__gen_ocl_printf_stub" && fnName != "__gen_ocl_puts_stub")
-           continue;
-@@ -582,7 +581,7 @@
-             if (!fmt_arg || !fmt_arg->isCString()) {
-               return false;
-             }
--            slot.state.str = fmt_arg->getAsCString();
-+            slot.state.str = fmt_arg->getAsCString().str();
-             return true;
-           }
-           case PRINTF_CONVERSION_P: {
-@@ -595,10 +594,10 @@
-
-         break;
-
--      case Type::VectorTyID: {
--        Type* vect_type = arg->getType();
--        Type* elt_type = vect_type->getVectorElementType();
--        int vec_num = vect_type->getVectorNumElements();
-+      case Type::FixedVectorTyID: {
-+        VectorType* vect_type = dyn_cast<VectorType>(arg->getType());
-+        Type* elt_type = vect_type->getElementType();
-+        int vec_num = vect_type->getNumElements();
-         bool sign = false;
-
-         if (vec_num != slot.state.vector_n) {
---- a/backend/src/llvm/llvm_profiling.cpp	2020-11-09 16:48:20.823866112 +0100
-+++ b/backend/src/llvm/llvm_profiling.cpp	2020-11-09 18:59:50.120929150 +0100
-@@ -35,7 +35,6 @@
- #include "llvm/IR/IRBuilder.h"
-
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
--#include "llvm/IR/CallSite.h"
- #include "llvm/IR/CFG.h"
- #else
- #include "llvm/Support/CallSite.h"
---- a/backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 16:48:20.823866112 +0100
-+++ b/backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 17:01:09.407774832 +0100
-@@ -45,8 +45,8 @@
-     bool visitCallInst(CallInst *I) {
-       if(!I)
-         return false;
--      Value *Callee = I->getCalledValue();
--      const std::string fnName = Callee->getName();
-+      Value *Callee = I->getCalledOperand();
-+      const std::string fnName = Callee->getName().str();
-       bool changed = false;
-       Type *boolTy = IntegerType::get(I->getContext(), 1);
-       Type *i32Ty = IntegerType::get(I->getContext(), 32);
-@@ -59,7 +59,7 @@
-         Value *needFixVal;
- #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
-         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
--        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
-+        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
-         {
-           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
-           uint32_t samplerInt = ci->getZExtValue();
-@@ -113,7 +113,7 @@
-         Value *needFixVal;
-  #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
-         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
--        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
-+        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
-         {
-           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
-           uint32_t samplerInt = ci->getZExtValue();
---- a/backend/src/llvm/llvm_scalarize.cpp	2020-11-09 16:48:20.823866112 +0100
-+++ b/backend/src/llvm/llvm_scalarize.cpp	2020-11-09 18:51:16.888990104 +0100
-@@ -178,7 +178,7 @@
-       if(!type)
-         return type;
-       switch(type->getTypeID()) {
--      case Type::VectorTyID:
-+      case Type::FixedVectorTyID:
-       case Type::ArrayTyID:
-         return GetBasicType(type->getContainedType(0));
-       default:
-@@ -188,7 +188,7 @@
-     }
-
-     int GetComponentCount(const Type* type)  {
--      if (type && type->getTypeID() == Type::VectorTyID)
-+      if (type && type->getTypeID() == Type::FixedVectorTyID)
-         return llvm::dyn_cast<VectorType>(type)->getNumElements();
-       else
-         return 1;
-@@ -652,13 +652,12 @@
-           break;
-         }
-       } else {
--        Value *Callee = call->getCalledValue();
--        const std::string fnName = Callee->getName();
-+        Value *Callee = call->getCalledOperand();
-+        const std::string fnName = Callee->getName().str();
-         auto genIntrinsicID = intrinsicMap.find(fnName);
-
-         // Get the function arguments
--        CallSite CS(call);
--        CallSite::arg_iterator CI = CS.arg_begin() + 1;
-+        User::op_iterator CI = call->arg_begin() + 1;
-
-         switch (genIntrinsicID) {
-           case GEN_OCL_NOT_FOUND:
-@@ -729,7 +728,7 @@
-             extractFromVector(call);
-             break;
-           case GEN_OCL_PRINTF:
--            for (; CI != CS.arg_end(); ++CI)
-+            for (; CI != call->arg_end(); ++CI)
-               if ((*CI)->getType()->isVectorTy())
-                 *CI = InsertToVector(call, *CI);
-             break;
diff --git a/srcpkgs/beignet/patches/llvm12.patch b/srcpkgs/beignet/patches/llvm12.patch
deleted file mode 100644
index 6f8ab005c148..000000000000
--- a/srcpkgs/beignet/patches/llvm12.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-diff --git backend/src/llvm/ExpandLargeIntegers.cpp backend/src/llvm/ExpandLargeIntegers.cpp
-index 8515dc13..27080380 100644
---- a/backend/src/llvm/ExpandLargeIntegers.cpp
-+++ b/backend/src/llvm/ExpandLargeIntegers.cpp
-@@ -328,7 +328,7 @@ static Value *buildVectorOrScalar(ConversionState &State, IRBuilder<> &IRB, Smal
-     // splited, that's why these temporary values should be erased.
-     bool KeepInsert = isLegalBitSize(ElemTy->getPrimitiveSizeInBits() * ElemNo);
-     for (unsigned i = 0; i < ElemNo; ++i) {
--      Value *tmp = vec ? vec : UndefValue::get(VectorType::get(ElemTy, ElemNo));
-+      Value *tmp = vec ? vec : UndefValue::get(VectorType::get(ElemTy, ElemNo, false));
-       Value *idx = ConstantInt::get(IntTy, i);
-       vec = IRB.CreateInsertElement(tmp, Elements[i], idx);
-       if (!KeepInsert && !isa<Constant>(vec)) {
-@@ -373,7 +373,7 @@ static void unifyElementType(IRBuilder<> &IRB, SmallVector<Value *, 16> &Src, Sm
-       assert((Size % MinWidth) == 0);
- 
-       if (Size > MinWidth) {
--        VectorType *VecTy = VectorType::get(ElemTy, Size/MinWidth);
-+        VectorType *VecTy = VectorType::get(ElemTy, Size/MinWidth, false);
-         Value *Casted = IRB.CreateBitCast(Src[i], VecTy);
-         for (unsigned j = 0; j < Size/MinWidth; j++)
-           Dst.push_back(IRB.CreateExtractElement(Casted, ConstantInt::get(IntTy, j)));
-@@ -462,7 +462,7 @@ static void convertInstruction(Instruction *Inst, ConversionState &State,
-       unsigned ElemNo = Unified.size();
-       Type *ElemTy = Unified[0]->getType();
-       for (unsigned i = 0; i < ElemNo; ++i) {
--        Value *tmp = vec ? vec : UndefValue::get(VectorType::get(ElemTy, ElemNo));
-+        Value *tmp = vec ? vec : UndefValue::get(VectorType::get(ElemTy, ElemNo, false));
-         Value *idx = ConstantInt::get(IntTy, i);
-         vec = IRB.CreateInsertElement(tmp, Unified[i], idx);
-       }
-diff --git backend/src/llvm/llvm_gen_backend.cpp backend/src/llvm/llvm_gen_backend.cpp
-index c93d89cc..64d5b0e5 100644
---- a/backend/src/llvm/llvm_gen_backend.cpp
-+++ b/backend/src/llvm/llvm_gen_backend.cpp
-@@ -304,7 +304,7 @@ namespace gbe
-       TYPESIZEVEC(long,8)
-       TYPESIZEVEC(unsigned long,8)
-       else{
--        StructType *StrTy = M->getTypeByName("struct."+name);
-+        StructType *StrTy = StructType::getTypeByName(M->getContext(), "struct."+name);
-         if(StrTy)
-           return getTypeByteSize(unit,StrTy);
-       }
-diff --git backend/src/llvm/llvm_loadstore_optimization.cpp backend/src/llvm/llvm_loadstore_optimization.cpp
-index 5aa38bef..6b5c1bad 100644
---- a/backend/src/llvm/llvm_loadstore_optimization.cpp
-+++ b/backend/src/llvm/llvm_loadstore_optimization.cpp
-@@ -152,7 +152,7 @@ namespace gbe {
-     unsigned addrSpace = ld->getPointerAddressSpace();
-     // insert before first load
-     Builder.SetInsertPoint(ld);
--    VectorType *vecTy = VectorType::get(ld->getType(), size);
-+    VectorType *vecTy = VectorType::get(ld->getType(), size, false);
-     Value *vecPtr = Builder.CreateBitCast(ld->getPointerOperand(),
-                                         PointerType::get(vecTy, addrSpace));
-     LoadInst *vecValue = Builder.CreateLoad(vecPtr);
-@@ -236,7 +236,7 @@ namespace gbe {
-     Builder.SetInsertPoint(merged[size-1]);
- 
-     Type *dataTy = st->getValueOperand()->getType();
--    VectorType *vecTy = VectorType::get(dataTy, size);
-+    VectorType *vecTy = VectorType::get(dataTy, size, false);
-     Value * parent = UndefValue::get(vecTy);
-     for(unsigned i = 0; i < size; i++) {
-       parent = Builder.CreateInsertElement(parent, values[i], ConstantInt::get(IntegerType::get(st->getContext(), 32), i));
-diff --git backend/src/llvm/llvm_printf_parser.cpp backend/src/llvm/llvm_printf_parser.cpp
-index 6bb7c52a..af459cd2 100644
---- a/backend/src/llvm/llvm_printf_parser.cpp
-+++ b/backend/src/llvm/llvm_printf_parser.cpp
-@@ -630,7 +630,7 @@ error:
-             if (elt_type != elt_dst_type) {
-               Value *II = NULL;
-               for (int i = 0; i < vec_num; i++) {
--                Value *vec = II ? II : UndefValue::get(VectorType::get(elt_dst_type, vec_num));
-+                Value *vec = II ? II : UndefValue::get(VectorType::get(elt_dst_type, vec_num, false));
-                 Value *cv = ConstantInt::get(Type::getInt32Ty(elt_type->getContext()), i);
-                 Value *org = builder->CreateExtractElement(arg, cv);
-                 Value *cvt = builder->CreateIntCast(org, elt_dst_type, sign);
-@@ -658,7 +658,7 @@ error:
-             if (elt_type->getTypeID() != Type::FloatTyID) {
-               Value *II = NULL;
-               for (int i = 0; i < vec_num; i++) {
--                Value *vec = II ? II : UndefValue::get(VectorType::get(Type::getFloatTy(elt_type->getContext()), vec_num));
-+                Value *vec = II ? II : UndefValue::get(VectorType::get(Type::getFloatTy(elt_type->getContext()), vec_num, false));
-                 Value *cv = ConstantInt::get(Type::getInt32Ty(elt_type->getContext()), i);
-                 Value *org = builder->CreateExtractElement(arg, cv);
-                 Value* cvt  = builder->CreateFPCast(org, Type::getFloatTy(module->getContext()));
-diff --git backend/src/llvm/llvm_to_gen.cpp backend/src/llvm/llvm_to_gen.cpp
-index 7f7deffe..9e8ccc67 100644
---- a/backend/src/llvm/llvm_to_gen.cpp
-+++ b/backend/src/llvm/llvm_to_gen.cpp
-@@ -358,7 +358,7 @@ namespace gbe
-     passes.add(createScalarReplAggregatesPass(64, true, -1, -1, 64));
- #endif
-     passes.add(createLoadStoreOptimizationPass());
--    passes.add(createConstantPropagationPass());
-+    //passes.add(createConstantPropagationPass());
-     passes.add(createPromoteMemoryToRegisterPass());
-     if(optLevel > 0)
-       passes.add(createGVNPass());                 // Remove redundancies
-@@ -367,11 +367,11 @@ namespace gbe
-     passes.add(createScalarizePass());             // Expand all vector ops
-     passes.add(createExpandLargeIntegersPass());   // legalize large integer operation
-     passes.add(createInstructionCombiningPass());  // legalize will generate some silly instructions
--    passes.add(createConstantPropagationPass());   // propagate constant after scalarize/legalize
-+    //passes.add(createConstantPropagationPass());   // propagate constant after scalarize/legalize
-     passes.add(createExpandConstantExprPass());    // constant prop may generate ConstantExpr
-     passes.add(createPromoteIntegersPass());       // align integer size to power of two
-     passes.add(createRemoveGEPPass(unit));         // Constant prop may generate gep
--    passes.add(createDeadInstEliminationPass());   // Remove simplified instructions
-+    //passes.add(createDeadInstEliminationPass());   // Remove simplified instructions
-     passes.add(createCFGSimplificationPass());     // Merge & remove BBs
-     passes.add(createLowerSwitchPass());           // simplify cfg will generate switch-case instruction
-     if (profiling) {
diff --git a/srcpkgs/beignet/patches/musl.patch b/srcpkgs/beignet/patches/musl.patch
deleted file mode 100644
index cefafbb65588..000000000000
--- a/srcpkgs/beignet/patches/musl.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/backend/src/backend/gen/gen_mesa_disasm.c
-+++ b/backend/src/backend/gen/gen_mesa_disasm.c
-@@ -1137,7 +1137,7 @@ static uint32_t __conv_half_to_float(uint16_t h)
-       // Adjust mantissa so it's normalized (and keep
-       // track of exponent adjustment)
-       int e = -1;
--      uint m = i.mantissa;
-+      unsigned int m = i.mantissa;
-       do {
-         e++;
-         m <<= 1;
diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
deleted file mode 100644
index dce6bbb7ae24..000000000000
--- a/srcpkgs/beignet/template
+++ /dev/null
@@ -1,22 +0,0 @@
-# Template file for 'beignet'
-pkgname=beignet
-version=1.3.2
-revision=10
-archs="i686* x86_64*"
-wrksrc="Beignet-${version}-Source"
-build_style=cmake
-hostmakedepends="clang llvm pkg-config"
-makedepends="MesaLib-devel libedit-devel libffi-devel ocl-icd-devel zlib-devel
- libXfixes-devel"
-depends="ocl-icd"
-short_desc="Beignet GPGPU System for Intel GPUs"
-maintainer="Orphaned <orphan@voidlinux.org>"
-license="LGPL-2.1-or-later"
-homepage="http://www.freedesktop.org/wiki/Software/Beignet/"
-distfiles="https://01.org/sites/default/files/${pkgname}-${version}-source.tar.gz"
-checksum=c555edba149de23243965a703f39f79fa06f15bcff5a3762b5544b0925010b43
-
-post_install() {
-	# remove CL headers, we do use opencl-headers instead.
-	rm -r ${DESTDIR}/usr/include
-}
diff --git a/srcpkgs/beignet/update b/srcpkgs/beignet/update
deleted file mode 100644
index ca41e0afe60c..000000000000
--- a/srcpkgs/beignet/update
+++ /dev/null
@@ -1 +0,0 @@
-site="https://01.org/beignet/downloads"
diff --git a/srcpkgs/removed-packages/template b/srcpkgs/removed-packages/template
index c23125bb0cb4..e023e7b6e4b7 100644
--- a/srcpkgs/removed-packages/template
+++ b/srcpkgs/removed-packages/template
@@ -22,6 +22,7 @@ replaces="
  atom<=1.44.0_1
  avogadro-devel<=1.2.0_8
  avogadro<=1.2.0_8
+ beignet<=1.3.2
  bokken<=1.8_3
  bomi<=0.9.11_17
  burp-client<=1.4.40_13

From d8fbfb3126b375bd73366d1f2eb66cfacde0db1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 28 Feb 2022 22:00:54 +0000
Subject: [PATCH 20/30] llvm13: update to 13.0.1.

---
 srcpkgs/llvm/template   | 2 +-
 srcpkgs/llvm13/template | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bcfee82098ff..96d18f730fca 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -4,8 +4,8 @@ version=13.0.0
 revision=1
 build_style=meta
 depends="llvm13"
-replaces="llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
 homepage="https://www.voidlinux.org"
+replaces="llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
diff --git a/srcpkgs/llvm13/template b/srcpkgs/llvm13/template
index bfc91056d277..8e673701fb9b 100644
--- a/srcpkgs/llvm13/template
+++ b/srcpkgs/llvm13/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm13'
 pkgname=llvm13
-version=13.0.0
-revision=2
+version=13.0.1
+revision=1
 wrksrc="llvm-project-${version}.src"
 build_wrksrc=llvm
 build_style=cmake
@@ -35,7 +35,7 @@ maintainer="q66 <daniel@octaforge.org>"
 license="Apache-2.0"
 homepage="https://www.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
-checksum=6075ad30f1ac0e15f07c1bf062c1e1268c241d674f11bd32cdf0e040c71f2bf3
+checksum=326335a830f2e32d06d0a36393b5455d17dc73e0bd1211065227ee014f92cbf8
 lib32disabled=yes
 python_version=3
 

From 32cdde4e2733647021447b3a6010701edc07ed57 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Wed, 2 Mar 2022 20:49:37 +0000
Subject: [PATCH 21/30] river: update to 0.1.3

---
 ...able-PIE-for-river-riverctl-rivertile.patch | 18 +++++++++---------
 srcpkgs/river/template                         |  4 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
index ecc68302db09..9da0e5d5d043 100644
--- a/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
+++ b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
@@ -10,33 +10,33 @@ build system. See: https://github.com/ziglang/zig/issues/7201
  1 file changed, 3 insertions(+)
 
 diff --git a/build.zig b/build.zig
-index d561f49..8ac9a4e 100644
+index 9829633..180179f 100644
 --- a/build.zig
 +++ b/build.zig
-@@ -85,6 +85,7 @@ pub fn build(b: *zbs.Builder) !void {
+@@ -89,6 +89,7 @@ pub fn build(b: *zbs.Builder) !void {
          const river = b.addExecutable("river", "river/main.zig");
          river.setTarget(target);
          river.setBuildMode(mode);
 +        river.pie = true;
-         river.addBuildOption(bool, "xwayland", xwayland);
-         river.addBuildOption([:0]const u8, "version", full_version);
+         river.addOptions("build_options", options);
  
-@@ -97,6 +98,7 @@ pub fn build(b: *zbs.Builder) !void {
+         addServerDeps(river, scanner);
+@@ -100,6 +101,7 @@ pub fn build(b: *zbs.Builder) !void {
          const riverctl = b.addExecutable("riverctl", "riverctl/main.zig");
          riverctl.setTarget(target);
          riverctl.setBuildMode(mode);
 +        riverctl.pie = true;
-         riverctl.addBuildOption([:0]const u8, "version", full_version);
+         riverctl.addOptions("build_options", options);
  
          riverctl.step.dependOn(&scanner.step);
-@@ -114,6 +116,7 @@ pub fn build(b: *zbs.Builder) !void {
+@@ -120,6 +122,7 @@ pub fn build(b: *zbs.Builder) !void {
          const rivertile = b.addExecutable("rivertile", "rivertile/main.zig");
          rivertile.setTarget(target);
          rivertile.setBuildMode(mode);
 +        rivertile.pie = true;
-         rivertile.addBuildOption([:0]const u8, "version", full_version);
+         rivertile.addOptions("build_options", options);
  
          rivertile.step.dependOn(&scanner.step);
 -- 
-2.33.1
+2.35.1
 
diff --git a/srcpkgs/river/template b/srcpkgs/river/template
index 9cf3abe4b85b..ae09ae54b34f 100644
--- a/srcpkgs/river/template
+++ b/srcpkgs/river/template
@@ -1,6 +1,6 @@
 # Template file for 'river'
 pkgname=river
-version=0.1.1
+version=0.1.3
 revision=1
 build_style=zig-build
 configure_args="$(vopt_if xwayland -Dxwayland)"
@@ -12,7 +12,7 @@ maintainer="Isaac Freund <mail@isaacfreund.com>"
 license="GPL-3.0-or-later"
 homepage="https://github.com/riverwm/river"
 distfiles="${homepage}/releases/download/v${version}/river-${version}.tar.gz"
-checksum=2a0bcd4670ed9ebd39c279f2bf10803fc65c9f3ee2307ce40728df23ce914d18
+checksum=f63444c300ab554ef3ca0d904a6b124a832c8397d474ef067bdde911c981c79f
 
 build_options="xwayland"
 build_options_default="xwayland"

From e09fafb751461bacb52afb1ce20d5aee67a11069 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Wed, 2 Mar 2022 20:50:17 +0000
Subject: [PATCH 22/30] rundird: remove package

    This has been deprecated by upstream which recommends using
    dumb_runtime_dir (already packaged for void) instead.

    Removing now since rundird 0.2.0 is not compatible with zig 0.9 and
    there won't be any new rundird releases.
---
 srcpkgs/removed-packages/template |  1 +
 srcpkgs/rundird/files/rundird/run |  2 --
 srcpkgs/rundird/template          | 17 -----------------
 3 files changed, 1 insertion(+), 19 deletions(-)
 delete mode 100644 srcpkgs/rundird/files/rundird/run
 delete mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/removed-packages/template b/srcpkgs/removed-packages/template
index e023e7b6e4b7..a4f5b632958b 100644
--- a/srcpkgs/removed-packages/template
+++ b/srcpkgs/removed-packages/template
@@ -357,6 +357,7 @@ replaces="
  rkt-stage1-coreos<=1.30.0_3
  rkt-stage1-fly<=1.30.0_3
  rkt<=1.30.0_3
+ rundird<=0.2.0_1
  scantailor<=0.9.12.1_2
  seahorse-sharing<=3.8.0_4
  seriespl<=2.3.5_2
diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
deleted file mode 100644
index e4aae8c83b4b..000000000000
--- a/srcpkgs/rundird/files/rundird/run
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-exec rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
deleted file mode 100644
index 5ff897abd456..000000000000
--- a/srcpkgs/rundird/template
+++ /dev/null
@@ -1,17 +0,0 @@
-# Template file for 'rundird'
-pkgname=rundird
-version=0.2.0
-revision=1
-build_style=zig-build
-makedepends="pam-devel"
-short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
-maintainer="Isaac Freund <mail@isaacfreund.com>"
-license="GPL-3.0-or-later"
-homepage="https://github.com/ifreund/rundird"
-distfiles="${homepage}/archive/v${version}.tar.gz"
-checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c
-
-post_install() {
-	vsv rundird
-	vdoc README.md
-}

From afc8d19668206831e16e2467fa61bf32a2068b75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 4 Mar 2022 11:55:46 +0000
Subject: [PATCH 23/30] bcc: rebuild for llvm13

---
 srcpkgs/bcc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 54509b63d5a7..2cfa0a2977d0 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.24.0
-revision=1
+revision=2
 wrksrc="bcc"
 build_style=cmake
 configure_args="-DREVISION=${version} -DENABLE_LLVM_SHARED=1"

From edcc6c6daca7c10eab6e3830b9a8fbc52ddf90a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 4 Mar 2022 11:56:32 +0000
Subject: [PATCH 24/30] gnome-builder: rebuild for llvm13

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 93559b21774f..5a5a51893ae8 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=41.3
-revision=1
+revision=2
 build_style=meson
 build_helper=qemu
 configure_args="-Dhelp=true -Dnetwork_tests=false"

From a967738d2638fb934f782943b5121d3b76bc922c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 4 Mar 2022 11:56:58 +0000
Subject: [PATCH 25/30] ldc: rebuild for llvm13

---
 srcpkgs/ldc/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/ldc/template b/srcpkgs/ldc/template
index a27280dde3b8..805978a81fd9 100644
--- a/srcpkgs/ldc/template
+++ b/srcpkgs/ldc/template
@@ -1,7 +1,7 @@
 # Template file for 'ldc'
 pkgname=ldc
 version=1.28.0
-revision=1
+revision=2
 wrksrc="ldc-${version}-src"
 build_style=cmake
 configure_args="
@@ -11,7 +11,7 @@ configure_args="
  -DBASH_COMPLETION_COMPLETIONSDIR=/usr/share/bash-completion
  -DC_SYSTEM_LIBS='unwind;m;pthread;rt;dl'"
 conf_files="/etc/ldc2.conf"
-hostmakedepends="dmd llvm12 perl pkg-config"
+hostmakedepends="dmd llvm perl pkg-config"
 makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel
  llvm-libunwind-devel"
 depends="ldc-runtime llvm-libunwind-devel"

From e426bdd0d47dad289e8a3c4a93f8e483db229642 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 4 Mar 2022 11:58:17 +0000
Subject: [PATCH 26/30] shiboken2: rebuild for llvm13

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index b56613229c13..ab9d2c4cb8f9 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.2
-revision=4
+revision=5
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From 91a9b62fc67d3a9140d995bcfb6dcce47048a41a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 4 Mar 2022 11:58:23 +0000
Subject: [PATCH 27/30] tilix: rebuild for llvm13

---
 srcpkgs/tilix/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tilix/template b/srcpkgs/tilix/template
index d8f014bc78c5..ac1bf7dd3bdd 100644
--- a/srcpkgs/tilix/template
+++ b/srcpkgs/tilix/template
@@ -1,7 +1,7 @@
 # Template file for 'tilix'
 pkgname=tilix
 version=1.9.4
-revision=3
+revision=4
 build_style=meson
 configure_args="-Db_lto=false"
 hostmakedepends="automake gettext-devel gdk-pixbuf glib-devel ldc po4a pkg-config

From 16e2bd3f34fdeeb7096d4aeadd49714a9a0fb94c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 4 Mar 2022 12:08:55 +0000
Subject: [PATCH 28/30] SPIRV-LLVM-Translator: rebuild for llvm13

---
 srcpkgs/SPIRV-LLVM-Translator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index 2504cabed367..852aa5cb3840 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -1,7 +1,7 @@
 # Template file for 'SPIRV-LLVM-Translator'
 pkgname=SPIRV-LLVM-Translator
 version=12.0.0
-revision=1
+revision=2
 build_style=cmake
 make_build_args="llvm-spirv"
 configure_args="-Wno-dev -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_SKIP_RPATH=ON

From 6c3cda0b7a4405fcd27988bc9f7d5a3608d3bbc7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 4 Mar 2022 12:11:49 +0000
Subject: [PATCH 29/30] ghdl: rebuild for llvm13

---
 ...b764f49666616063d4239df83b5aed961fff.patch | 49 -------------------
 .../patches/{llvm12.patch => llvm13.patch}    |  1 +
 srcpkgs/ghdl/template                         |  7 +--
 3 files changed, 5 insertions(+), 52 deletions(-)
 delete mode 100644 srcpkgs/ghdl/patches/396eb764f49666616063d4239df83b5aed961fff.patch
 rename srcpkgs/ghdl/patches/{llvm12.patch => llvm13.patch} (90%)

diff --git a/srcpkgs/ghdl/patches/396eb764f49666616063d4239df83b5aed961fff.patch b/srcpkgs/ghdl/patches/396eb764f49666616063d4239df83b5aed961fff.patch
deleted file mode 100644
index 23c5673e593e..000000000000
--- a/srcpkgs/ghdl/patches/396eb764f49666616063d4239df83b5aed961fff.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 396eb764f49666616063d4239df83b5aed961fff Mon Sep 17 00:00:00 2001
-From: Jeroen Van den Keybus <jeroen.vandenkeybus@gmail.com>
-Date: Mon, 26 Apr 2021 20:17:40 +0200
-Subject: [PATCH] Migrate deprecated DebugLoc::get to DILocation::get
-
----
- src/ortho/llvm6/llvm-cbindings.cpp | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/src/ortho/llvm6/llvm-cbindings.cpp b/src/ortho/llvm6/llvm-cbindings.cpp
-index f82845ffcd..98470d8fab 100644
---- a/src/ortho/llvm6/llvm-cbindings.cpp
-+++ b/src/ortho/llvm6/llvm-cbindings.cpp
-@@ -1254,7 +1254,7 @@ new_var_decl(ODnode *Res, OIdent Ident, OStorage Storage, OTnode Atype)
-          DebugCurrentLine, Atype->Dbg, true);
-       DBuilder->insertDeclare
-         (unwrap(Decl), D, DBuilder->createExpression(),
--         DebugLoc::get(DebugCurrentLine, 0, DebugCurrentScope),
-+         DILocation::get(DebugCurrentScope->getContext(), DebugCurrentLine, 0, DebugCurrentScope),
-          unwrap(LLVMGetInsertBlock(DeclBuilder)));
-     }
- #endif
-@@ -1597,7 +1597,7 @@ start_subprogram_body(ODnodeSubprg *Func)
-     DebugCurrentScope = DebugCurrentSubprg;
- 
-     unwrap(Builder)->SetCurrentDebugLocation
--      (DebugLoc::get(DebugCurrentLine, 0, DebugCurrentScope));
-+      (DILocation::get(DebugCurrentScope->getContext(), DebugCurrentLine, 0, DebugCurrentScope));
-   }
- 
-   if (FlagDebug) {
-@@ -1612,7 +1612,7 @@ start_subprogram_body(ODnodeSubprg *Func)
-          DebugCurrentFile, DebugCurrentLine, Inter->Dtype->Dbg, true);
-       DBuilder->insertDeclare
-         (unwrap(Var), D, DBuilder->createExpression(),
--         DebugLoc::get(DebugCurrentLine, 0, DebugCurrentSubprg),
-+         DILocation::get(DebugCurrentSubprg->getContext(), DebugCurrentLine, 0, DebugCurrentSubprg),
-          unwrap(LLVMGetInsertBlock(DeclBuilder)));
-       LLVMBuildStore(DeclBuilder, Inter->Ref, Var);
-       Inter->Ref = Var;
-@@ -2759,7 +2759,7 @@ new_debug_line_stmt (unsigned Line)
-   if (FlagDebugLines && Line != DebugCurrentLine) {
-     DebugCurrentLine = Line;
-     unwrap(Builder)->SetCurrentDebugLocation
--      (DebugLoc::get(DebugCurrentLine, 0, DebugCurrentScope));
-+      (DILocation::get(DebugCurrentScope->getContext(), DebugCurrentLine, 0, DebugCurrentScope));
-   }
- #endif
- }
diff --git a/srcpkgs/ghdl/patches/llvm12.patch b/srcpkgs/ghdl/patches/llvm13.patch
similarity index 90%
rename from srcpkgs/ghdl/patches/llvm12.patch
rename to srcpkgs/ghdl/patches/llvm13.patch
index 8d2f76bfda06..38ddb088e832 100644
--- a/srcpkgs/ghdl/patches/llvm12.patch
+++ b/srcpkgs/ghdl/patches/llvm13.patch
@@ -7,6 +7,7 @@ index c1c1a6d..dad7c38 100755
         check_version 10.0 $llvm_version ||
         check_version 11.0 $llvm_version ||
 +       check_version 12.0 $llvm_version ||
++       check_version 13.0 $llvm_version ||
         false; then
      echo "Debugging is enabled with llvm $llvm_version"
    else
diff --git a/srcpkgs/ghdl/template b/srcpkgs/ghdl/template
index e756d8c3cd87..8a5f2e623203 100644
--- a/srcpkgs/ghdl/template
+++ b/srcpkgs/ghdl/template
@@ -6,7 +6,7 @@
 #
 pkgname=ghdl
 reverts="20181129_1"
-version=1.0.0
+version=2.0.0
 revision=1
 build_style=configure
 configure_args="--prefix=/usr --srcdir=.. --incdir=lib/ghdl/include"
@@ -16,7 +16,7 @@ maintainer="m3tav3rse <mtvrs@tuta.io>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/ghdl/ghdl"
 distfiles="https://github.com/ghdl/ghdl/archive/v${version}.tar.gz"
-checksum=cb424766fbe831ff41bec84016a6af0406d735c272b0b639d507c3503df30495
+checksum=5f258369e0faf730298916dfdc134c54c25a7a8a7f19722b7ce2717db19af6ec
 nocross=yes
 make_check=extended
 
@@ -51,7 +51,7 @@ fi
 
 if [ "$build_option_llvm" ]; then
 	subpackages+=" ghdl-llvm"
-	makedepends+=" llvm12"
+	makedepends+=" llvm"
 fi
 
 do_configure() {
@@ -135,3 +135,4 @@ ghdl-llvm_package() {
 		vmove usr/lib/ghdl/llvm
 	}
 }
+

From cd2e4db37a97762d9045b1b887acbe8a6f832723 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Fri, 4 Mar 2022 12:13:18 +0000
Subject: [PATCH 30/30] rust: rebuild for llvm13

---
 srcpkgs/rust/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template
index 560a629f3da2..27f491d3c697 100644
--- a/srcpkgs/rust/template
+++ b/srcpkgs/rust/template
@@ -9,10 +9,10 @@
 #
 pkgname=rust
 version=1.57.0
-revision=1
+revision=2
 wrksrc="rustc-${version}-src"
 hostmakedepends="cmake curl pkg-config python3 tar cargo-bootstrap"
-makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm12"
+makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm"
 depends="rust-std"
 short_desc="Safe, concurrent, practical systems language"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -34,7 +34,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" rust llvm12"
+	hostmakedepends+=" rust llvm"
 	# These are required for building the buildhost's stage0/1
 	hostmakedepends+=" libffi-devel libxml2-devel ncurses-devel zlib-devel"
 else

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
@ 2022-03-20  7:58 ` dkwo
  2022-03-20 14:03 ` Llvm13 motorto
                   ` (97 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-20  7:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073192371

Comment:
Thanks. Can you fix the trivial linting?
```
srcpkgs/ghdl/template:138: Last line is empty
srcpkgs/llvm12/template:8: use SPDX id for 'metapackage' license or see Manual.md
```
And perhaps then let it run on CI?
I'd also like this to be merged, as `river` does not work well with xwayland at the moment.

@q66 Can you review this?

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
  2022-03-20  7:58 ` Llvm13 dkwo
@ 2022-03-20 14:03 ` motorto
  2022-03-20 16:23 ` Llvm13 motorto
                   ` (96 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: motorto @ 2022-03-20 14:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 319 bytes --]

New comment by motorto on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073258556

Comment:
> Thanks. Can you fix the trivial linting?

Will do that, I will rebuild all packages locally. Could you check that all the packages that I am rebuilding need to be rebuild ? 

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
  2022-03-20  7:58 ` Llvm13 dkwo
  2022-03-20 14:03 ` Llvm13 motorto
@ 2022-03-20 16:23 ` motorto
  2022-03-20 17:59 ` Llvm13 dkwo
                   ` (95 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: motorto @ 2022-03-20 16:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

New comment by motorto on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073258556

Comment:
> Thanks. Can you fix the trivial linting?

Will do that, I will rebuild all packages locally. Could you check that all the packages that I am rebuilding need to be rebuild ? 

@dkwo / @ifreund  could you try to compile llvm13 on your pc ? My dual core is failing and I am not sure if its because of my low hardware

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (2 preceding siblings ...)
  2022-03-20 16:23 ` Llvm13 motorto
@ 2022-03-20 17:59 ` dkwo
  2022-03-21  7:20 ` Llvm13 dkwo
                   ` (94 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-20 17:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073301810

Comment:
xrevshlib libllvm{12,13} also includes gtkd, onedrive: perhaps rebuild these as well?
I'm building llvm13 now, will report back.


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (3 preceding siblings ...)
  2022-03-20 17:59 ` Llvm13 dkwo
@ 2022-03-21  7:20 ` dkwo
  2022-03-21  7:28 ` Llvm13 dkwo
                   ` (93 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-21  7:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 11454 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073547605

Comment:
on x86_64, it now fails with
```
[3060/7532] Generating html Sphinx documentation for libunwind into "/builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/html"                                                                                                                                  
FAILED: projects/libunwind/docs/CMakeFiles/docs-libunwind-html /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/CMakeFiles/docs-libunwind-html                                                                                                               
cd /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs && /usr/bin/cmake -E env /usr/bin/sphinx-build -b html -d /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/_doctrees-libunwind-html -q -t builder-html /builddir/llvm-project-13.0.1.
src/libunwind/docs /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/html                                            
Traceback (most recent call last):                                                                                                      
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 579, in _build_master                                        
    ws.require(__requires__)                                     
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 897, in require                                              
    needed = self.resolve(parse_requirements(requirements))                                                                             
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 788, in resolve                                              
    raise VersionConflict(dist, req).with_context(dependent_req)                                                                        
pkg_resources.ContextualVersionConflict: (docutils 0.18.1 (/usr/lib/python3.10/site-packages), Requirement.parse('docutils<0.18,>=0.14'), {'Sphinx'})                                                                                                                            
                                                                                                                                        
During handling of the above exception, another exception occurred:
                                                                                                                                        
Traceback (most recent call last):                     
  File "/usr/bin/sphinx-build", line 33, in <module>                                                                                    
    sys.exit(load_entry_point('Sphinx==4.2.0', 'console_scripts', 'sphinx-build')())                                                    
  File "/usr/bin/sphinx-build", line 25, in importlib_load_entry_point                                                                  
    return next(matches).load()          
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load                                                          
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module                                                          
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import                                                                       
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load                                                                    
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked                                                           
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module                                                               
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed                                                          
  File "/usr/lib/python3.10/site-packages/sphinx/cmd/build.py", line 25, in <module>                                                    
    from sphinx.application import Sphinx                                                                                               
  File "/usr/lib/python3.10/site-packages/sphinx/application.py", line 43, in <module>                                                  
    from sphinx.registry import SphinxComponentRegistry                                                                                 
  File "/usr/lib/python3.10/site-packages/sphinx/registry.py", line 24, in <module>                                                                                                                                                                                              
    from pkg_resources import iter_entry_points                                                                                                                                                                                                                                  
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3247, in <module>                                            
    def _initialize_master_working_set():           
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3221, in _call_aside                                                                                                                                                                                  
    f(*args, **kwargs)                               
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3259, in _initialize_master_working_set                      
    working_set = WorkingSet._build_master()                                                                                                                                                                                                                                     
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 581, in _build_master                                        
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 594, in _build_from_requirements                                                                                                                                                                      
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 783, in resolve                                              
    raise DistributionNotFound(req, requirers)                                                                                          
pkg_resources.DistributionNotFound: The 'docutils<0.18,>=0.14' distribution was not found and is required by Sphinx

[3066/7532] Generating html Sphinx documentation for libcxx into "/builddir/llvm-project-13.0.1.src/llvm/build/projects/libcxx/docs/html"                                                                                                                                        
FAILED: projects/libcxx/docs/CMakeFiles/docs-libcxx-html /builddir/llvm-project-13.0.1.src/llvm/build/projects/libcxx/docs/CMakeFiles/docs-libcxx-html                                                                                                                           
cd /builddir/llvm-project-13.0.1.src/llvm/build/projects/libcxx/docs && /usr/bin/cmake -E env /usr/bin/sphinx-build -b html -d /builddir/llvm-project-13.0.1.src/llvm/build/projects/libcxx/docs/_doctrees-libcxx-html -q -t builder-html /builddir/llvm-project-13.0.1.src/libcx
x/docs /builddir/llvm-project-13.0.1.src/llvm/build/projects/libcxx/docs/html                                                                                                                                                                                                    
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 579, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 897, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 788, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (docutils 0.18.1 (/usr/lib/python3.10/site-packages), Requirement.parse('docutils<0.18,>=0.14'), {'Sphinx'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/sphinx-build", line 33, in <module>
    sys.exit(load_entry_point('Sphinx==4.2.0', 'console_scripts', 'sphinx-build')())
  File "/usr/bin/sphinx-build", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load 
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/sphinx/cmd/build.py", line 25, in <module>
    from sphinx.application import Sphinx
  File "/usr/lib/python3.10/site-packages/sphinx/application.py", line 43, in <module>
    from sphinx.registry import SphinxComponentRegistry
  File "/usr/lib/python3.10/site-packages/sphinx/registry.py", line 24, in <module>
    from pkg_resources import iter_entry_points
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3247, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3221, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3259, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 581, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 594, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 783, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'docutils<0.18,>=0.14' distribution was not found and is required by Sphinx
```

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (4 preceding siblings ...)
  2022-03-21  7:20 ` Llvm13 dkwo
@ 2022-03-21  7:28 ` dkwo
  2022-03-21  8:35 ` Llvm13 dkwo
                   ` (92 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-21  7:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073551874

Comment:
Does `pkg_resources.DistributionNotFound: The 'docutils<0.18,>=0.14' distribution was not found and is required by Sphinx` mean that our docutils (0.18.1) is too recent?

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (5 preceding siblings ...)
  2022-03-21  7:28 ` Llvm13 dkwo
@ 2022-03-21  8:35 ` dkwo
  2022-03-21  8:48 ` Llvm13 motorto
                   ` (91 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-21  8:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073633650

Comment:
I'm now trying to build it after downgrading docutils to 0.17

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (6 preceding siblings ...)
  2022-03-21  8:35 ` Llvm13 dkwo
@ 2022-03-21  8:48 ` motorto
  2022-03-21  8:56 ` Llvm13 dkwo
                   ` (90 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: motorto @ 2022-03-21  8:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

New comment by motorto on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073642341

Comment:
That seems to be the issue Sphinx upstream doesn't support docutils-0.18.X

https://github.com/sphinx-doc/sphinx/issues/9777

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (7 preceding siblings ...)
  2022-03-21  8:48 ` Llvm13 motorto
@ 2022-03-21  8:56 ` dkwo
  2022-03-21  9:44 ` Llvm13 dkwo
                   ` (89 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-21  8:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 219 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073648800

Comment:
@sgn @ahesford The recent update of docutils breaks sphinx: can we downgrade it?

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (8 preceding siblings ...)
  2022-03-21  8:56 ` Llvm13 dkwo
@ 2022-03-21  9:44 ` dkwo
  2022-03-21  9:50 ` Llvm13 dkwo
                   ` (88 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-21  9:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 257 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073689641

Comment:
Ok, llvm13 builds fine on x86_64 after downgrading docutils:

-version=0.18.1
-revision=1
+version=0.17.1
+revision=3


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (9 preceding siblings ...)
  2022-03-21  9:44 ` Llvm13 dkwo
@ 2022-03-21  9:50 ` dkwo
  2022-03-21  9:57 ` Llvm13 dkwo
                   ` (87 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-21  9:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 680 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073696356

Comment:
also zig builds, but river:

=> river-0.1.3_1: installing host dependencies: pkg-config-0.29.2_3 wayland-devel-1.20.0_1 scdoc-1.11.2_1 git-2.35.1_1 zig-0.9.1_1 ...
=> river-0.1.3_1: installing target dependencies: wlroots-devel-0.15.1_1 ...
=> river-0.1.3_1: removing autodeps, please wait...
=> ERROR: river-0.1.3_1: failed to install target dependencies! (error 8)
mesa-opencl-21.3.7_1: broken, unresolvable shlib `libclang-cpp.so.12'
Transaction aborted due to unresolved shlibs.
=> ERROR: Please see above for the real error, exiting...


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (10 preceding siblings ...)
  2022-03-21  9:50 ` Llvm13 dkwo
@ 2022-03-21  9:57 ` dkwo
  2022-03-21 10:53 ` Llvm13 sgn
                   ` (86 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-21  9:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 196 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073702409

Comment:
Forget about river, it also builds after rebuilding mesa.

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (11 preceding siblings ...)
  2022-03-21  9:57 ` Llvm13 dkwo
@ 2022-03-21 10:53 ` sgn
  2022-03-21 12:27 ` Llvm13 dkwo
                   ` (85 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: sgn @ 2022-03-21 10:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 248 bytes --]

New comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073751330

Comment:
> @sgn @ahesford The recent update of docutils breaks sphinx: can we downgrade it?

Sphinx has been updated.

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (12 preceding siblings ...)
  2022-03-21 10:53 ` Llvm13 sgn
@ 2022-03-21 12:27 ` dkwo
  2022-03-23 14:38 ` Llvm13 dkwo
                   ` (84 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-21 12:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1073831669

Comment:
Thanks. Indeed, after rebasing, llvm13 builds fine here.

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (13 preceding siblings ...)
  2022-03-21 12:27 ` Llvm13 dkwo
@ 2022-03-23 14:38 ` dkwo
  2022-03-23 16:08 ` Llvm13 dkwo
                   ` (83 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-23 14:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 5902 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1076452676

Comment:
On the other hand, when building `llvm13` for `x86-64_musl`, it fails at
```
[3912/7532] Linking CXX shared library lib/clang/13.0.1/lib/linux/libclang_rt.scudo_standalone-x86_64.so                                                                                                                                                                         
FAILED: lib/clang/13.0.1/lib/linux/libclang_rt.scudo_standalone-x86_64.so                                                                                                                                                                                                        
: && /usr/bin/g++ -fPIC -DNDEBUG -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -O2    -fdebug-prefix-map=/builddir/llvm-project-13.0.1.src=. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -W
write-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -W
misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++14 -Wno-unused-parameter -O3 -DNDEBUG  -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -Wl,-z,defs -Wl,-z,nodelete   -m64 -Wl,-z,defs,-z,now,-z,relro -ffunction-sections -fdata-sections -W
l,--gc-sections -pthread -Wl,-rpath-link,/builddir/llvm-project-13.0.1.src/llvm/build/./lib -shared -Wl,-soname,libclang_rt.scudo_standalone-x86_64.so -o lib/clang/13.0.1/lib/linux/libclang_rt.scudo_standalone-x86_64.so projects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsa
n.x86_64.dir/common.cpp.o projects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsan.x86_64.dir/crash_handler.cpp.o projects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsan.x86_64.dir/platform_specific/common_posix.cpp.o projects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsan.x86
_64.dir/platform_specific/guarded_pool_allocator_posix.cpp.o projects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsan.x86_64.dir/platform_specific/mutex_posix.cpp.o projects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsan.x86_64.dir/platform_specific/utilities_posix.cpp.o proj
ects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsan.x86_64.dir/guarded_pool_allocator.cpp.o projects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsan.x86_64.dir/stack_trace_compressor.cpp.o projects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsanBacktraceLibc.x86_64.dir/optional
/backtrace_linux_libc.cpp.o projects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsanSegvHandler.x86_64.dir/optional/segv_handler_posix.cpp.o projects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsanOptionsParser.x86_64.dir/optional/options_parser.cpp.o projects/compiler-rt/lib/
scudo/standalone/CMakeFiles/clang_rt.scudo_standalone-dynamic-x86_64.dir/checksum.cpp.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/clang_rt.scudo_standalone-dynamic-x86_64.dir/common.cpp.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/clang_rt.scudo_standa
lone-dynamic-x86_64.dir/crc32_hw.cpp.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/clang_rt.scudo_standalone-dynamic-x86_64.dir/flags_parser.cpp.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/clang_rt.scudo_standalone-dynamic-x86_64.dir/flags.cpp.o project
s/compiler-rt/lib/scudo/standalone/CMakeFiles/clang_rt.scudo_standalone-dynamic-x86_64.dir/fuchsia.cpp.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/clang_rt.scudo_standalone-dynamic-x86_64.dir/linux.cpp.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/clang
_rt.scudo_standalone-dynamic-x86_64.dir/release.cpp.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/clang_rt.scudo_standalone-dynamic-x86_64.dir/report.cpp.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/clang_rt.scudo_standalone-dynamic-x86_64.dir/string_uti
ls.cpp.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/clang_rt.scudo_standalone-dynamic-x86_64.dir/wrappers_c.cpp.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/clang_rt.scudo_standalone-dynamic-x86_64.dir/wrappers_cpp.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib" &&
 :                                                                                                                                                                                                                                                                               
/usr/bin/ld: projects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsanBacktraceLibc.x86_64.dir/optional/backtrace_linux_libc.cpp.o: in function `(anonymous namespace)::SegvBacktrace(unsigned long*, unsigned long, void*)':                                                       
./llvm/build/./compiler-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp:25: undefined reference to `backtrace'                                                                                                                                                                 
/usr/bin/ld: projects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsanBacktraceLibc.x86_64.dir/optional/backtrace_linux_libc.cpp.o: in function `(anonymous namespace)::Backtrace(unsigned long*, unsigned long)':
./llvm/build/./compiler-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp:25: undefined reference to `backtrace'
/usr/bin/ld: projects/compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsanBacktraceLibc.x86_64.dir/optional/backtrace_linux_libc.cpp.o: in function `(anonymous namespace)::PrintBacktrace(unsigned long*, unsigned long, void (*)(char const*, ...))':
./llvm/build/./compiler-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp:44: undefined reference to `backtrace_symbols'
collect2: error: ld returned 1 exit status
```

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (14 preceding siblings ...)
  2022-03-23 14:38 ` Llvm13 dkwo
@ 2022-03-23 16:08 ` dkwo
  2022-03-24 14:56 ` Llvm13 motorto
                   ` (82 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-23 16:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 325 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1076470425

Comment:
This pr for llvm13 has one patch less then our llvm12, still at 20 something.
(For comparison Alpine has 3 patches.)
Are all our patches needed for cross? Which are actually necessary?

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (15 preceding siblings ...)
  2022-03-23 16:08 ` Llvm13 dkwo
@ 2022-03-24 14:56 ` motorto
  2022-03-27  9:19 ` Llvm13 wael444
                   ` (81 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: motorto @ 2022-03-24 14:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]

New comment by motorto on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1077719933

Comment:
That's interesting, actually  I picked on the work made previously, and 
worked from there. The only thing I changed on the template was the 
bump to .1 release.

Now, to  your question. I am not aware of what patches are really 
needed, for cross compiling for all archs that void support, someone 
more knowledge on the distro might help.

(I am going to join the IRC channel #xbps, ping me there, so we can get 
this issue solved, I am "motorto" there).

On qua, mar 23 2022 at 08:00:51 -0700, dkwo ***@***.***> 
wrote:
> This pr for llvm13 has one patch less then our llvm12, still at 20 
> something.
>  (For comparison Alpine has 3 patches.)
>  Are all our patches needed for cross? Which are actually necessary?
> 
> —
> Reply to this email directly, view it on GitHub 
> <https://github.com/void-linux/void-packages/pull/36229#issuecomment-1076470425>, 
> or unsubscribe 
> <https://github.com/notifications/unsubscribe-auth/AMRTQPJONLNKQKVRUBLQJCDVBMW2HANCNFSM5REOSBUA>.
> You are receiving this because you authored the thread.Message ID: 
> ***@***.***>
> 



^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (16 preceding siblings ...)
  2022-03-24 14:56 ` Llvm13 motorto
@ 2022-03-27  9:19 ` wael444
  2022-03-27  9:23 ` Llvm13 wael444
                   ` (80 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: wael444 @ 2022-03-27  9:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

New comment by wael444 on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1079889653

Comment:
How come LLVM13 for Void Linux is taking this long to get added? is it not receiving the attention it needs from the primary maintainers?

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (17 preceding siblings ...)
  2022-03-27  9:19 ` Llvm13 wael444
@ 2022-03-27  9:23 ` wael444
  2022-03-27  9:41 ` Llvm13 Anachron
                   ` (79 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: wael444 @ 2022-03-27  9:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 774 bytes --]

New comment by wael444 on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1079889653

Comment:
How come LLVM13 for Void Linux is taking this long to get added? is it not receiving the attention it needs from the primary maintainers?

edit:
```
-- Configuring done
-- Generating done
-- Build files have been written to: /builddir/llvm-project-13.0.1.src/llvm/build
=> llvm13-13.0.1_1: running pre-build hook: 02-script-wrapper ...
=> llvm13-13.0.1_1: running do_build ...
ninja: error: loading 'build.ninja': No such file or directory
=> ERROR: llvm13-13.0.1_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 1
=> ERROR:   in do_build() at common/build-style/cmake.sh:85
```

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (18 preceding siblings ...)
  2022-03-27  9:23 ` Llvm13 wael444
@ 2022-03-27  9:41 ` Anachron
  2022-03-27 10:47 ` Llvm13 wael444
                   ` (78 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: Anachron @ 2022-03-27  9:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 315 bytes --]

New comment by Anachron on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1079893015

Comment:
@wael444 not sure how your comment is helpful at all.

This community is based purely on volunteers.

If something takes too long for you, feel free to give a helpful hand.

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (19 preceding siblings ...)
  2022-03-27  9:41 ` Llvm13 Anachron
@ 2022-03-27 10:47 ` wael444
  2022-03-27 11:06 ` Llvm13 wael444
                   ` (77 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: wael444 @ 2022-03-27 10:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

New comment by wael444 on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1079903433

Comment:
https://github.com/void-linux/void-packages/pull/35895#issuecomment-1073074433

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (20 preceding siblings ...)
  2022-03-27 10:47 ` Llvm13 wael444
@ 2022-03-27 11:06 ` wael444
  2022-03-27 11:29 ` Llvm13 q66
                   ` (76 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: wael444 @ 2022-03-27 11:06 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

New comment by wael444 on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1079903433

Comment:
https://github.com/void-linux/void-packages/pull/35895#issuecomment-1073074433

also: i am merely just someone wanting to use `river`. 

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (21 preceding siblings ...)
  2022-03-27 11:06 ` Llvm13 wael444
@ 2022-03-27 11:29 ` q66
  2022-03-27 11:56 ` Llvm13 dkwo
                   ` (75 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: q66 @ 2022-03-27 11:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 201 bytes --]

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1079910505

Comment:
llvm14 is out now, so we should probably jump straight to that 

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (22 preceding siblings ...)
  2022-03-27 11:29 ` Llvm13 q66
@ 2022-03-27 11:56 ` dkwo
  2022-03-27 14:20 ` Llvm13 ifreund
                   ` (74 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-27 11:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 355 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1079914938

Comment:
After adding this patch, I was able to build `llvm13` for `x86_64-musl`.
https://github.com/llvm/llvm-project/commit/d6906be01281e9b39b12ecbbb0f1d755d52e21f7.patch
from https://github.com/llvm/llvm-project/pull/351

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (23 preceding siblings ...)
  2022-03-27 11:56 ` Llvm13 dkwo
@ 2022-03-27 14:20 ` ifreund
  2022-03-27 14:41 ` Llvm13 motorto
                   ` (73 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: ifreund @ 2022-03-27 14:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 507 bytes --]

New comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1079941567

Comment:
> llvm14 is out now, so we should probably jump straight to that

One downside to jumping straight to 14 is that it will probably be a few months until there is a zig release compatible with llvm 14. Furthermore, I believe patching zig ourselves would very non-trivial this time due to major changes in llvm's API relating to making all pointers in the IR opaque.

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (24 preceding siblings ...)
  2022-03-27 14:20 ` Llvm13 ifreund
@ 2022-03-27 14:41 ` motorto
  2022-03-27 15:05 ` Llvm13 motorto
                   ` (72 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: motorto @ 2022-03-27 14:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

New comment by motorto on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1079945408

Comment:
> After adding this patch, I was able to build `llvm13` for `x86_64-musl`.

Added the patch and rebased, thanks ! I am going to create an musl vm and report back.

@wael444, if you want to help fell free to build all changed packages in this pr and report back please, don't know if you are using any different arch/libc library. I moved way from void because I needed the llvm13, I am still working in this using a vm (I intend to come back once this is merged).

> edit:
> 
> ```
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /builddir/llvm-project-13.0.1.src/llvm/build
> => llvm13-13.0.1_1: running pre-build hook: 02-script-wrapper ...
> => llvm13-13.0.1_1: running do_build ...
> ninja: error: loading 'build.ninja': No such file or directory
> => ERROR: llvm13-13.0.1_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 1
> => ERROR:   in do_build() at common/build-style/cmake.sh:85
> ```

@dkwo and I build it successful on x86_64 glibc,  6 days ago. Are you using any different arch ?

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (25 preceding siblings ...)
  2022-03-27 14:41 ` Llvm13 motorto
@ 2022-03-27 15:05 ` motorto
  2022-03-27 16:02 ` Llvm13 wael444
                   ` (71 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: motorto @ 2022-03-27 15:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]

New comment by motorto on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1079945408

Comment:
> After adding this patch, I was able to build `llvm13` for `x86_64-musl`.

(Going to do this) 
* Added the patch and rebased, thanks ! I am going to create an musl vm and report back.

@wael444, if you want to help fell free to build all changed packages in this pr and report back please, don't know if you are using any different arch/libc library. I moved way from void because I needed the llvm13, I am still working in this using a vm (I intend to come back once this is merged).

> edit:
> 
> ```
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /builddir/llvm-project-13.0.1.src/llvm/build
> => llvm13-13.0.1_1: running pre-build hook: 02-script-wrapper ...
> => llvm13-13.0.1_1: running do_build ...
> ninja: error: loading 'build.ninja': No such file or directory
> => ERROR: llvm13-13.0.1_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 1
> => ERROR:   in do_build() at common/build-style/cmake.sh:85
> ```

@dkwo and I build it successful on x86_64 glibc,  6 days ago. Are you using any different arch ?

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (26 preceding siblings ...)
  2022-03-27 15:05 ` Llvm13 motorto
@ 2022-03-27 16:02 ` wael444
  2022-03-27 18:52 ` Llvm13 dkwo
                   ` (70 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: wael444 @ 2022-03-27 16:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 770 bytes --]

New comment by wael444 on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1079960563

Comment:
> @dkwo and I build it successful on x86_64 glibc, 6 days ago. Are you using any different arch ?

No.
```
-- Build files have been written to: /builddir/llvm-project-13.0.1.src/llvm/build
=> llvm13-13.0.1_1: running pre-build hook: 02-script-wrapper ...
=> llvm13-13.0.1_1: running do_build ...
ninja: error: loading 'build.ninja': No such file or directory
=> ERROR: llvm13-13.0.1_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 1
=> ERROR:   in do_build() at common/build-style/cmake.sh:85
$ xuname
Void 5.17.0-tkg-pds_22 x86_64 GenuineIntel uptodate rFFFFFFFFFFFFFF
```

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (27 preceding siblings ...)
  2022-03-27 16:02 ` Llvm13 wael444
@ 2022-03-27 18:52 ` dkwo
  2022-03-27 19:12 ` Llvm13 wael444
                   ` (69 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-27 18:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1079997374

Comment:
@motorto As I said, with that patch it builds fine on `x86_64` both glibc and musl. Can you rebase on master, add that patch, and let it run on CI?
@wael444 just zap first.

I also agree we should do llvm13 first, and hofully soon, as it is close to working condition.

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (28 preceding siblings ...)
  2022-03-27 18:52 ` Llvm13 dkwo
@ 2022-03-27 19:12 ` wael444
  2022-03-28  7:17 ` Llvm13 dkwo
                   ` (68 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: wael444 @ 2022-03-27 19:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 704 bytes --]

New comment by wael444 on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1080000958

Comment:
> @wael444 just zap first.

```
~/.local/src/llvm13 $ ./xbps-src zap 2>&1 >/dev/null
~/.local/src/llvm13 $ ./xbps-src binary-bootstrap 2>&1 >/dev/null
~/.local/src/llvm13 $ ./xbps-src pkg river  
...
=> llvm13-13.0.1_1: running pre-build hook: 02-script-wrapper ...
=> llvm13-13.0.1_1: running do_build ...
ninja: error: loading 'build.ninja': No such file or directory
=> ERROR: llvm13-13.0.1_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 1
=> ERROR:   in do_build() at common/build-style/cmake.sh:85
```

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (29 preceding siblings ...)
  2022-03-27 19:12 ` Llvm13 wael444
@ 2022-03-28  7:17 ` dkwo
  2022-03-28 14:16 ` Llvm13 motorto
                   ` (67 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: dkwo @ 2022-03-28  7:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 179 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1080285693

Comment:
Zap and then pkg -f llvm13, not river..


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (30 preceding siblings ...)
  2022-03-28  7:17 ` Llvm13 dkwo
@ 2022-03-28 14:16 ` motorto
  2022-03-28 18:45 ` Llvm13 wael444
                   ` (66 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: motorto @ 2022-03-28 14:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

New comment by motorto on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1080711162

Comment:
```
./llvm/build/./compiler-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp:44: undefined reference to `backtrace_symbols'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
=> ERROR: llvm13-13.0.1_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 1
=> ERROR:   in do_build() at common/build-style/cmake.sh:85
```

didn't push yet because I am having the same issue as @wael444

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (31 preceding siblings ...)
  2022-03-28 14:16 ` Llvm13 motorto
@ 2022-03-28 18:45 ` wael444
  2022-03-28 18:52 ` Llvm13 wael444
                   ` (65 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: wael444 @ 2022-03-28 18:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

New comment by wael444 on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1081012718

Comment:
after @dkwo 's comment i ran zap then built `llvm13`, 1/5 of the way of it compiling i stopped it as it didn't report the error as before.
so i tried `river` this time and llvm13 is picked up and is currently being built.
i will try to update on if it is successfully built.

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (32 preceding siblings ...)
  2022-03-28 18:45 ` Llvm13 wael444
@ 2022-03-28 18:52 ` wael444
  2022-03-28 18:58 ` Llvm13 wael444
                   ` (64 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: wael444 @ 2022-03-28 18:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4671 bytes --]

New comment by wael444 on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1081012718

Comment:
after @dkwo 's comment i ran zap then built `llvm13`, 1/5 of the way of it compiling i stopped it as it didn't report the error as before.
so i tried `river` this time and llvm13 is picked up and is currently being built.
i will try to update on if it is successfully built.

edit: 
```
[328/4810] Copying CXX header typeinfo
[329/4810] Generating html Sphinx documentation for libunwind into "/builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/html"
FAILED: projects/libunwind/docs/CMakeFiles/docs-libunwind-html /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/CMakeFiles/docs-libunwind-html 
cd /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs && /usr/bin/cmake -E env /usr/bin/sphinx-build -b html -d /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/_doctrees-libunwind-html -q -t builder-html /builddir/llvm-project-13.0.1.src/libunwind/docs /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/html
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 579, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 897, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 788, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (docutils 0.18.1 (/usr/lib/python3.10/site-packages), Requirement.parse('docutils<0.18,>=0.14'), {'Sphinx'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/sphinx-build", line 33, in <module>
    sys.exit(load_entry_point('Sphinx==4.2.0', 'console_scripts', 'sphinx-build')())
  File "/usr/bin/sphinx-build", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/sphinx/cmd/build.py", line 25, in <module>
    from sphinx.application import Sphinx
  File "/usr/lib/python3.10/site-packages/sphinx/application.py", line 43, in <module>
    from sphinx.registry import SphinxComponentRegistry
  File "/usr/lib/python3.10/site-packages/sphinx/registry.py", line 24, in <module>
    from pkg_resources import iter_entry_points
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3247, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3221, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3259, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 581, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 594, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 783, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'docutils<0.18,>=0.14' distribution was not found and is required by Sphinx
[330/4810] Copying CXX header utility
[331/4810] Copying CXX header unordered_set
[332/4810] Copying CXX header valarray
[333/4810] Copying CXX header unordered_map
[334/4810] Copying CXX header variant
ninja: build stopped: subcommand failed.
=> ERROR: llvm13-13.0.1_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 1
=> ERROR:   in do_build() at common/build-style/cmake.sh:85
```

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (33 preceding siblings ...)
  2022-03-28 18:52 ` Llvm13 wael444
@ 2022-03-28 18:58 ` wael444
  2022-03-28 19:19 ` Llvm13 wael444
                   ` (63 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: wael444 @ 2022-03-28 18:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4883 bytes --]

New comment by wael444 on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1081012718

Comment:
after @dkwo 's comment i ran zap then built `llvm13`, 1/5 of the way of it compiling i stopped it as it didn't report the error as before.
so i tried `river` this time and llvm13 is picked up and is currently being built.
i will try to update on if it is successfully built.

edit: 
```
[328/4810] Copying CXX header typeinfo
[329/4810] Generating html Sphinx documentation for libunwind into "/builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/html"
FAILED: projects/libunwind/docs/CMakeFiles/docs-libunwind-html /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/CMakeFiles/docs-libunwind-html 
cd /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs && /usr/bin/cmake -E env /usr/bin/sphinx-build -b html -d /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/_doctrees-libunwind-html -q -t builder-html /builddir/llvm-project-13.0.1.src/libunwind/docs /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/html
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 579, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 897, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 788, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (docutils 0.18.1 (/usr/lib/python3.10/site-packages), Requirement.parse('docutils<0.18,>=0.14'), {'Sphinx'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/sphinx-build", line 33, in <module>
    sys.exit(load_entry_point('Sphinx==4.2.0', 'console_scripts', 'sphinx-build')())
  File "/usr/bin/sphinx-build", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/sphinx/cmd/build.py", line 25, in <module>
    from sphinx.application import Sphinx
  File "/usr/lib/python3.10/site-packages/sphinx/application.py", line 43, in <module>
    from sphinx.registry import SphinxComponentRegistry
  File "/usr/lib/python3.10/site-packages/sphinx/registry.py", line 24, in <module>
    from pkg_resources import iter_entry_points
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3247, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3221, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3259, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 581, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 594, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 783, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'docutils<0.18,>=0.14' distribution was not found and is required by Sphinx
[330/4810] Copying CXX header utility
[331/4810] Copying CXX header unordered_set
[332/4810] Copying CXX header valarray
[333/4810] Copying CXX header unordered_map
[334/4810] Copying CXX header variant
ninja: build stopped: subcommand failed.
=> ERROR: llvm13-13.0.1_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 1
=> ERROR:   in do_build() at common/build-style/cmake.sh:85
```

after adding `python3-docutils` to make depends
```
pkg_resources.ContextualVersionConflict: (docutils 0.18.1 (/usr/lib/python3.10/site-packages), Requirement.parse('docutils<0.18,>=0.14'), {'Sphinx'})
```

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (34 preceding siblings ...)
  2022-03-28 18:58 ` Llvm13 wael444
@ 2022-03-28 19:19 ` wael444
  2022-03-29  8:28 ` [PR PATCH] [Updated] Llvm13 motorto
                   ` (62 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: wael444 @ 2022-03-28 19:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 5078 bytes --]

New comment by wael444 on void-packages repository

https://github.com/void-linux/void-packages/pull/36229#issuecomment-1081012718

Comment:
after @dkwo 's comment i ran zap then built `llvm13`, 1/5 of the way of it compiling i stopped it as it didn't report the error as before.
so i tried `river` this time and llvm13 is picked up and is currently being built.
i will try to update on if it is successfully built.

edit: 
```
[328/4810] Copying CXX header typeinfo
[329/4810] Generating html Sphinx documentation for libunwind into "/builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/html"
FAILED: projects/libunwind/docs/CMakeFiles/docs-libunwind-html /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/CMakeFiles/docs-libunwind-html 
cd /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs && /usr/bin/cmake -E env /usr/bin/sphinx-build -b html -d /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/_doctrees-libunwind-html -q -t builder-html /builddir/llvm-project-13.0.1.src/libunwind/docs /builddir/llvm-project-13.0.1.src/llvm/build/projects/libunwind/docs/html
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 579, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 897, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 788, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (docutils 0.18.1 (/usr/lib/python3.10/site-packages), Requirement.parse('docutils<0.18,>=0.14'), {'Sphinx'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/sphinx-build", line 33, in <module>
    sys.exit(load_entry_point('Sphinx==4.2.0', 'console_scripts', 'sphinx-build')())
  File "/usr/bin/sphinx-build", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/sphinx/cmd/build.py", line 25, in <module>
    from sphinx.application import Sphinx
  File "/usr/lib/python3.10/site-packages/sphinx/application.py", line 43, in <module>
    from sphinx.registry import SphinxComponentRegistry
  File "/usr/lib/python3.10/site-packages/sphinx/registry.py", line 24, in <module>
    from pkg_resources import iter_entry_points
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3247, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3221, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3259, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 581, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 594, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 783, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'docutils<0.18,>=0.14' distribution was not found and is required by Sphinx
[330/4810] Copying CXX header utility
[331/4810] Copying CXX header unordered_set
[332/4810] Copying CXX header valarray
[333/4810] Copying CXX header unordered_map
[334/4810] Copying CXX header variant
ninja: build stopped: subcommand failed.
=> ERROR: llvm13-13.0.1_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 1
=> ERROR:   in do_build() at common/build-style/cmake.sh:85
```

after adding `python3-docutils` to make depends
```
pkg_resources.ContextualVersionConflict: (docutils 0.18.1 (/usr/lib/python3.10/site-packages), Requirement.parse('docutils<0.18,>=0.14'), {'Sphinx'})
```
above is related to https://github.com/void-linux/void-packages/issues/36227, which is solved in python3-Sphinx's 4.4.0 update in void-packages. @motorto i suggest you update the llvm13 branch.

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [PR PATCH] [Updated] Llvm13
  2022-03-19 20:12 [PR PATCH] Llvm13 motorto
                   ` (35 preceding siblings ...)
  2022-03-28 19:19 ` Llvm13 wael444
@ 2022-03-29  8:28 ` motorto
  2022-03-29  8:29 ` Llvm13 motorto
                   ` (61 subsequent siblings)
  98 siblings, 0 replies; 101+ messages in thread
From: motorto @ 2022-03-29  8:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]

There is an updated pull request by motorto against master on the void-packages repository

https://github.com/motorto/void-packages llvm13
https://github.com/void-linux/void-packages/pull/36229

Llvm13
This adds LLVM 13 and updates from LLVM 12.

Work-in-progress

The following packages were removed:
 * beignet -- upstream is dead
 * rundird --  has been deprecated by upstream which recommends using dumb_runtime_dir

The following packages were updated or patched:
 * ispc
 * qtcreator
 * river
 * zig

Rebuilt packages:

(rebuilt based on output of:  `xrevshlib libllvm{12,13}` )


* SPIRV-LLVM-Translator
* bcc
* bpftrace 
* ccls 
* clazy 
* codelite 
* ghdl
* gnome-builder
* include-what-you-use 
* juCi++ 
* kdevelop 
* ldc
* mesa 
* qt5 
* rtags 
* rust
* shiboken2 
* tilix

Updated Templates:

* Chromium

(I am probably missing some packages)


Thanks @DBLouis for your hard work! 

 [ci skip]
 
 I nuked the #35895

A patch file from https://github.com/void-linux/void-packages/pull/36229.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm13-36229.patch --]
[-- Type: text/x-diff, Size: 556675 bytes --]

From da5f557afc43ff91fe997c91b4231910019ff3e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Fri, 31 Dec 2021 16:21:30 +0200
Subject: [PATCH 01/31] New package: llvm13-13.0.0

---
 common/shlibs                                 |  16 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm13                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm13/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 110 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  13 +
 .../patches/clang-004-ppc64-musl-elfv2.patch  |  48 ++
 .../compiler-rt-aarch64-ucontext.patch        |  11 +
 .../compiler-rt-sanitizer-ppc64-musl.patch    |  35 ++
 .../patches/compiler-rt-xray-ppc64-musl.patch |  62 +++
 srcpkgs/llvm13/patches/libcxx-musl.patch      |  26 ++
 srcpkgs/llvm13/patches/libcxx-ppc.patch       |  22 +
 .../llvm13/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm13/patches/libcxxabi-dl.patch     |  25 ++
 srcpkgs/llvm13/patches/libunwind-ppc32.patch  |  63 +++
 srcpkgs/llvm13/patches/lldb-musl.patch        |  31 ++
 srcpkgs/llvm13/patches/llvm-001-musl.patch    |  57 +++
 .../patches/llvm-002-musl-ppc64-elfv2.patch   |  30 ++
 .../patches/llvm-003-ppc-secureplt.patch      |  11 +
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm13/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../patches/llvm-006-aarch64-mf_exec.patch    |  25 ++
 .../llvm13/patches/ppc32-compiler-rt.patch    |  21 +
 srcpkgs/llvm13/template                       | 423 ++++++++++++++++++
 srcpkgs/llvm13/update                         |   3 +
 42 files changed, 1165 insertions(+), 20 deletions(-)
 create mode 120000 srcpkgs/libllvm13
 create mode 100644 srcpkgs/llvm13/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm13/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm13/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm13/patches/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm13/patches/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm13/patches/compiler-rt-aarch64-ucontext.patch
 create mode 100644 srcpkgs/llvm13/patches/compiler-rt-sanitizer-ppc64-musl.patch
 create mode 100644 srcpkgs/llvm13/patches/compiler-rt-xray-ppc64-musl.patch
 create mode 100644 srcpkgs/llvm13/patches/libcxx-musl.patch
 create mode 100644 srcpkgs/llvm13/patches/libcxx-ppc.patch
 create mode 100644 srcpkgs/llvm13/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm13/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm13/patches/libunwind-ppc32.patch
 create mode 100644 srcpkgs/llvm13/patches/lldb-musl.patch
 create mode 100644 srcpkgs/llvm13/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm13/patches/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm13/patches/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm13/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm13/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm13/patches/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm13/patches/ppc32-compiler-rt.patch
 create mode 100644 srcpkgs/llvm13/template
 create mode 100644 srcpkgs/llvm13/update

diff --git a/common/shlibs b/common/shlibs
index ccc55a1b3772..7561585ec56e 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -973,11 +973,12 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.12 lldb-12.0.0_1
-libclang.so.12 libclang-12.0.0_1
-libclang-cpp.so.12 libclang-cpp-12.0.0_1
+liblldb.so.13 lldb-13.0.0_1
+libclang.so.13 libclang-13.0.0_1
+libclang-cpp.so.13 libclang-cpp-13.0.0_1
 libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
+libLLVM-13.so libllvm13-13.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
@@ -4145,3 +4146,12 @@ librz_lang.so.0.3.4 rizin-0.3.4_1
 librz_search.so.0.3.4 rizin-0.3.4_1
 librz_bin.so.0.3.4 rizin-0.3.4_1
 libaravis-0.8.so.0 libaravis-0.8.21_1
+libomp.so libomp-13.0.0_1
+libomptarget.rtl.amdgpu.so libomp-13.0.0_1
+libomptarget.rtl.cuda.so libomp-13.0.0_1
+libomptarget.rtl.x86_64.so libomp-13.0.0_1
+libarcher.so libomp-13.0.0_1
+libomptarget.so libomp-13.0.0_1
+liblldbIntelFeatures.so.13 lldb-13.0.0_1
+libLTO.so.13 llvm13-13.0.0_1
+libRemarks.so.13 llvm13-13.0.0_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libllvm13 b/srcpkgs/libllvm13
new file mode 120000
index 000000000000..d6366d7d3b95
--- /dev/null
+++ b/srcpkgs/libllvm13
@@ -0,0 +1 @@
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index cd60fd7a981b..d6366d7d3b95 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm12
\ No newline at end of file
+llvm13
\ No newline at end of file
diff --git a/srcpkgs/llvm13/files/llvm-Config-llvm-config.h b/srcpkgs/llvm13/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm13/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm13/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm13/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm13/patches/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/clang/lib/Headers/unwind.h
++++ b/clang/lib/Headers/unwind.h
+@@ -9,9 +9,6 @@
+ 
+ /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
+ 
+-#ifndef __CLANG_UNWIND_H
+-#define __CLANG_UNWIND_H
+-
+ #if defined(__APPLE__) && __has_include_next(<unwind.h>)
+ /* Darwin (from 11.x on) provide an unwind.h. If that's available,
+  * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm13/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm13/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..25688d40dbc2
--- /dev/null
+++ b/srcpkgs/llvm13/patches/clang-002-add-musl-triples.patch
@@ -0,0 +1,110 @@
+--- a/clang/lib/Driver/ToolChains/Gnu.cpp
++++ b/clang/lib/Driver/ToolChains/Gnu.cpp
+@@ -2086,7 +2086,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2153,8 +2154,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+       "powerpc64-suse-linux", "powerpc-montavista-linuxspe"};
+   static const char *const PPCLELibDirs[] = {"/lib32", "/lib"};
+   static const char *const PPCLETriples[] = {"powerpcle-linux-gnu",
+-                                             "powerpcle-unknown-linux-gnu",
+-                                             "powerpcle-linux-musl"};
++                                             "powerpcle-unknown-linux-gnu"};
+ 
+   static const char *const PPC64LibDirs[] = {"/lib64", "/lib"};
+   static const char *const PPC64Triples[] = {
+@@ -2235,6 +2235,87 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPCLEMuslTriples[] = {"powerpcle-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppcle:
++      LibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
++      TripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      BiarchTripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      BiarchLibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
++      BiarchTripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm13/patches/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm13/patches/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 000000000000..4ad6412d1e6c
--- /dev/null
+++ b/srcpkgs/llvm13/patches/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,13 @@
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -504,10 +504,6 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
+-    Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
+-    break;
+   case llvm::Triple::ppc64le:
+     LibDir = "lib64";
+     Loader =
diff --git a/srcpkgs/llvm13/patches/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm13/patches/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 000000000000..21fc8003c5f1
--- /dev/null
+++ b/srcpkgs/llvm13/patches/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,48 @@
+--- a/clang/lib/Basic/Targets/PPC.h
++++ b/clang/lib/Basic/Targets/PPC.h
+@@ -415,11 +415,10 @@ public:
+       LongDoubleFormat = &llvm::APFloat::IEEEdouble();
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       DataLayout = "e-m:e-i64:64-n32:64";
+-      ABI = "elfv2";
+     } else {
+       DataLayout = "E-m:e-i64:64-n32:64";
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+ 
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) {
+       LongDoubleWidth = LongDoubleAlign = 64;
+--- a/clang/lib/CodeGen/TargetInfo.cpp
++++ b/clang/lib/CodeGen/TargetInfo.cpp
+@@ -10927,9 +10927,9 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
+       return SetCGInfo(new AIXTargetCodeGenInfo(Types, /*Is64Bit*/ true));
+ 
+     if (Triple.isOSBinFormatELF()) {
+-      PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv1;
+-      if (getTarget().getABI() == "elfv2")
+-        Kind = PPC64_SVR4_ABIInfo::ELFv2;
++      PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv2;
++      if (getTarget().getABI() == "elfv1")
++        Kind = PPC64_SVR4_ABIInfo::ELFv1;
+       bool IsSoftFloat = CodeGenOpts.FloatABI == "soft";
+ 
+       return SetCGInfo(
+--- a/clang/lib/Driver/ToolChains/Clang.cpp
++++ b/clang/lib/Driver/ToolChains/Clang.cpp
+@@ -1920,14 +1920,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+   const llvm::Triple &T = getToolChain().getTriple();
+   if (T.isOSBinFormatELF()) {
+     switch (getToolChain().getArch()) {
+-    case llvm::Triple::ppc64: {
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
+-      break;
+-    }
++    case llvm::Triple::ppc64:
+     case llvm::Triple::ppc64le:
+       ABIName = "elfv2";
+       break;
diff --git a/srcpkgs/llvm13/patches/compiler-rt-aarch64-ucontext.patch b/srcpkgs/llvm13/patches/compiler-rt-aarch64-ucontext.patch
new file mode 100644
index 000000000000..893c059d7b8d
--- /dev/null
+++ b/srcpkgs/llvm13/patches/compiler-rt-aarch64-ucontext.patch
@@ -0,0 +1,11 @@
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp.orig
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+@@ -1799,7 +1799,7 @@
+ 
+ static bool Aarch64GetESR(ucontext_t *ucontext, u64 *esr) {
+   static const u32 kEsrMagic = 0x45535201;
+-  u8 *aux = ucontext->uc_mcontext.__reserved;
++  u8 *aux = reinterpret_cast<u8 *>(ucontext->uc_mcontext.__reserved);
+   while (true) {
+     _aarch64_ctx *ctx = (_aarch64_ctx *)aux;
+     if (ctx->size == 0) break;
diff --git a/srcpkgs/llvm13/patches/compiler-rt-sanitizer-ppc64-musl.patch b/srcpkgs/llvm13/patches/compiler-rt-sanitizer-ppc64-musl.patch
new file mode 100644
index 000000000000..35f16d24f340
--- /dev/null
+++ b/srcpkgs/llvm13/patches/compiler-rt-sanitizer-ppc64-musl.patch
@@ -0,0 +1,35 @@
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+@@ -74,6 +74,10 @@
+ #include <sys/utsname.h>
+ #endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #include <sys/personality.h>
+ #endif
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+@@ -92,7 +92,7 @@
+ # include <utime.h>
+ # include <sys/ptrace.h>
+ #if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-    SANITIZER_RISCV64
++    defined(__powerpc__) || SANITIZER_RISCV64
+ #  include <asm/ptrace.h>
+ #  ifdef __arm__
+ typedef struct user_fpregs elf_fpregset_t;
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
+@@ -31,7 +31,7 @@
+ #include <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // for NT_PRSTATUS
+-#if (defined(__aarch64__) || SANITIZER_RISCV64) && !SANITIZER_ANDROID
++#if (defined(__aarch64__) || defined(__powerpc__) || SANITIZER_RISCV64) && !SANITIZER_ANDROID
+ // GLIBC 2.20+ sys/user does not include asm/ptrace.h
+ # include <asm/ptrace.h>
+ #endif
diff --git a/srcpkgs/llvm13/patches/compiler-rt-xray-ppc64-musl.patch b/srcpkgs/llvm13/patches/compiler-rt-xray-ppc64-musl.patch
new file mode 100644
index 000000000000..d0b61c80c897
--- /dev/null
+++ b/srcpkgs/llvm13/patches/compiler-rt-xray-ppc64-musl.patch
@@ -0,0 +1,62 @@
+--- a/compiler-rt/lib/xray/xray_powerpc64.inc
++++ b/compiler-rt/lib/xray/xray_powerpc64.inc
+@@ -12,7 +12,13 @@
+ 
+ #include <cstdint>
+ #include <mutex>
++#ifdef __GLIBC__
+ #include <sys/platform/ppc.h>
++#else
++#include <cctype>
++#include <cstring>
++#include <cstdlib>
++#endif
+ 
+ #include "xray_defs.h"
+ 
+@@ -20,13 +26,45 @@ namespace __xray {
+ 
+ ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
+   CPU = 0;
++#ifdef __GLIBC__
+   return __ppc_get_timebase();
++#else
++  return __builtin_ppc_get_timebase();
++#endif
+ }
+ 
+ inline uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
+   static std::mutex M;
+   std::lock_guard<std::mutex> Guard(M);
++#ifdef __GLIBC__
+   return __ppc_get_timebase_freq();
++#else
++  /* FIXME: a less dirty implementation? */
++  static uint64_t base;
++  if (!base) {
++    FILE *f = fopen("/proc/cpuinfo", "rb");
++    if (f) {
++      ssize_t nr;
++      /* virtually always big enough to hold the line */
++      char buf[512];
++      while (fgets(buf, sizeof(buf), f)) {
++        char *ret = strstr(buf, "timebase");
++        if (!ret) {
++          continue;
++        }
++        ret += sizeof("timebase") - 1;
++        ret = strchr(ret, ':');
++        if (!ret) {
++          continue;
++        }
++        base = strtoul(ret + 1, nullptr, 10);
++        break;
++      }
++      fclose(f);
++    }
++  }
++  return base;
++#endif
+ }
+ 
+ inline bool probeRequiredCPUFeatures() XRAY_NEVER_INSTRUMENT {
diff --git a/srcpkgs/llvm13/patches/libcxx-musl.patch b/srcpkgs/llvm13/patches/libcxx-musl.patch
new file mode 100644
index 000000000000..bbd31ffc2cb1
--- /dev/null
+++ b/srcpkgs/llvm13/patches/libcxx-musl.patch
@@ -0,0 +1,26 @@
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -742,7 +742,11 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
+         typename remove_reference<decltype(errno)>::type __save_errno = errno;
+         errno = 0;
+         char *__p2;
++#if defined(__linux__) && !defined(__GLIBC__)
++        long long __ll = strtoll(__a, &__p2, __base);
++#else
+         long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
++#endif
+         typename remove_reference<decltype(errno)>::type __current_errno = errno;
+         if (__current_errno == 0)
+             errno = __save_errno;
+@@ -782,7 +786,11 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
+         typename remove_reference<decltype(errno)>::type __save_errno = errno;
+         errno = 0;
+         char *__p2;
++#if defined(__linux__) && !defined(__GLIBC__)
++        unsigned long long __ll = strtoull(__a, &__p2, __base);
++#else
+         unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
++#endif
+         typename remove_reference<decltype(errno)>::type __current_errno = errno;
+         if (__current_errno == 0)
+             errno = __save_errno;
diff --git a/srcpkgs/llvm13/patches/libcxx-ppc.patch b/srcpkgs/llvm13/patches/libcxx-ppc.patch
new file mode 100644
index 000000000000..7a92f8004e1c
--- /dev/null
+++ b/srcpkgs/llvm13/patches/libcxx-ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- a/libcxx/include/limits
++++ b/libcxx/include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/llvm13/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm13/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm13/patches/libcxx-ssp-nonshared.patch
@@ -0,0 +1,11 @@
+--- a/libcxx/CMakeLists.txt
++++ b/libcxx/CMakeLists.txt
+@@ -769,6 +769,8 @@ function(cxx_link_system_libraries target)
+     target_link_libraries(${target} PRIVATE atomic)
+   endif()
+ 
++#ssp  target_link_libraries(${target} PRIVATE ssp_nonshared)
++
+   if (MINGW)
+     target_link_libraries(${target} PRIVATE "${MINGW_LIBRARIES}")
+   endif()
diff --git a/srcpkgs/llvm13/patches/libcxxabi-dl.patch b/srcpkgs/llvm13/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm13/patches/libcxxabi-dl.patch
@@ -0,0 +1,25 @@
+Also link to -ldl to prevent undefined references.
+
+--- a/libcxxabi/src/CMakeLists.txt
++++ b/libcxxabi/src/CMakeLists.txt
+@@ -73,6 +73,7 @@
+   endif()
+ 
+   add_library_flags_if(LIBCXXABI_HAS_C_LIB c)
++  add_library_flags_if(LIBCXXABI_HAS_C_LIB dl)
+ endif()
+ 
+ if (LIBCXXABI_USE_LLVM_UNWINDER)
+--- a/libcxx/CMakeLists.txt
++++ b/libcxx/CMakeLists.txt
+@@ -745,6 +745,10 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm13/patches/libunwind-ppc32.patch b/srcpkgs/llvm13/patches/libunwind-ppc32.patch
new file mode 100644
index 000000000000..74aa7576ecf9
--- /dev/null
+++ b/srcpkgs/llvm13/patches/libunwind-ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- a/libunwind/include/__libunwind_config.h
++++ b/libunwind/include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- a/libunwind/src/UnwindRegistersRestore.S
++++ b/libunwind/src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- a/libunwind/src/UnwindRegistersSave.S
++++ b/libunwind/src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- a/libunwind/src/config.h
++++ b/libunwind/src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- a/libunwind/src/libunwind.cpp
++++ b/libunwind/src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm13/patches/lldb-musl.patch b/srcpkgs/llvm13/patches/lldb-musl.patch
new file mode 100644
index 000000000000..601c0d138523
--- /dev/null
+++ b/srcpkgs/llvm13/patches/lldb-musl.patch
@@ -0,0 +1,31 @@
+--- a/lldb/source/Plugins/Process/Linux/Procfs.h
++++ b/lldb/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm13/patches/llvm-001-musl.patch b/srcpkgs/llvm13/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..f2a3f8d62813
--- /dev/null
+++ b/srcpkgs/llvm13/patches/llvm-001-musl.patch
@@ -0,0 +1,57 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index 34a8a1e3..1214ece5 100644
+--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ class Triple;
+diff --git a/lib/Support/Unix/DynamicLibrary.inc b/lib/Support/Unix/DynamicLibrary.inc
+index a2a37996..2f86c470 100644
+--- a/llvm/lib/Support/Unix/DynamicLibrary.inc
++++ b/llvm/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/llvm/utils/unittest/googletest/src/gtest.cc
++++ b/llvm/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm13/patches/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm13/patches/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 000000000000..0071d964bd37
--- /dev/null
+++ b/srcpkgs/llvm13/patches/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,30 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp
+index 0634833e..b7cbc2e7 100644
+--- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -222,9 +222,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+diff --git a/test/CodeGen/PowerPC/ppc64-elf-abi.ll b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+index 8b1cf6b5..296a2afa 100644
+--- a/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm13/patches/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm13/patches/llvm-003-ppc-secureplt.patch
new file mode 100644
index 000000000000..b5d15974375d
--- /dev/null
+++ b/srcpkgs/llvm13/patches/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -165,7 +165,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm13/patches/llvm-004-override-opt.patch b/srcpkgs/llvm13/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm13/patches/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/llvm/CMakeLists.txt
++++ b/llvm/CMakeLists.txt
+@@ -918,6 +918,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
+   llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
+ endif()
+ 
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm13/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm13/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm13/patches/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,36 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index cce21f32..87ca5f9b 100644
+--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -520,7 +520,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/lib/Target/PowerPC/PPCMCInstLower.cpp b/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 5cc180d7..a5b02565 100644
+--- a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -117,7 +117,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
diff --git a/srcpkgs/llvm13/patches/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm13/patches/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 000000000000..a00abd216665
--- /dev/null
+++ b/srcpkgs/llvm13/patches/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -58,7 +58,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm13/patches/ppc32-compiler-rt.patch b/srcpkgs/llvm13/patches/ppc32-compiler-rt.patch
new file mode 100644
index 000000000000..8e0a9a779d1b
--- /dev/null
+++ b/srcpkgs/llvm13/patches/ppc32-compiler-rt.patch
@@ -0,0 +1,21 @@
+commit ba4ede595ff9599232f5dd2b4384c243137b53fc
+Author: Daniel Kolesa <daniel@octaforge.org>
+Date:   Tue Jun 22 23:40:54 2021 +0200
+
+    enable compiler-rt support for ppc32
+
+diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
+index 1edab43..5c0c8a2 100644
+--- a/compiler-rt/cmake/base-config-ix.cmake
++++ b/compiler-rt/cmake/base-config-ix.cmake
+@@ -182,9 +182,7 @@ macro(test_targets)
+     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc64le")
+       test_target_arch(powerpc64le "" "-m64")
+     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc")
+-      if(CMAKE_SYSTEM_NAME MATCHES "AIX")
+-        test_target_arch(powerpc "" "-m32")
+-      endif()
++      test_target_arch(powerpc "" "-m32")
+       test_target_arch(powerpc64 "" "-m64")
+     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "s390x")
+       test_target_arch(s390x "" "")
diff --git a/srcpkgs/llvm13/template b/srcpkgs/llvm13/template
new file mode 100644
index 000000000000..08d847472525
--- /dev/null
+++ b/srcpkgs/llvm13/template
@@ -0,0 +1,423 @@
+# Template file for 'llvm13'
+pkgname=llvm13
+version=13.0.0
+revision=1
+wrksrc="llvm-project-${version}.src"
+build_wrksrc=llvm
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release -Wno-dev
+ -DENABLE_LINKER_BUILD_ID=YES
+ -DLLDB_USE_SYSTEM_SIX=YES
+ -DLIBCXX_CXX_ABI=libcxxabi
+ -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLLVM_INCLUDE_DOCS=YES
+ -DLLVM_BUILD_DOCS=YES
+ -DLLVM_ENABLE_SPHINX=YES
+ -DSPHINX_WARNINGS_AS_ERRORS=NO
+ -DLLVM_INSTALL_UTILS=YES
+ -DLLVM_BUILD_LLVM_DYLIB=YES
+ -DLLVM_LINK_LLVM_DYLIB=YES
+ -DLLVM_ENABLE_RTTI=YES
+ -DLLVM_ENABLE_FFI=YES
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
+ python3-recommonmark python3-sphinx-automodapi"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm13>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
+checksum=6075ad30f1ac0e15f07c1bf062c1e1268c241d674f11bd32cdf0e040c71f2bf3
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
+	makedepends+=" libexecinfo-devel"
+	depends+=" libexecinfo-devel"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;libunwind;lld"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm13"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; then
+		if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+			vsed -i 's|__ptrace_request|int|g' \
+				${wrksrc}/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+		fi
+		# disable docs for lldb as they fail to generate
+		vsed -i '/add_subdirectory(docs)/d' \
+			${wrksrc}/lldb/CMakeLists.txt
+	fi
+
+	# update config.guess for better platform detection
+	cp $XBPS_COMMONDIR/environment/configure/automake/config.guess \
+		${wrksrc}/llvm/cmake
+
+	# fix linker failures on some archs
+	vsed -i 's,check_library_exists(gcc_s .*,set(LIBCXXABI_HAS_GCC_S_LIB ON),' \
+		${wrksrc}/libcxxabi/cmake/config-ix.cmake
+	vsed -i 's,check_library_exists(gcc .*,set(LIBCXXABI_HAS_GCC_LIB ON),' \
+		${wrksrc}/libcxxabi/cmake/config-ix.cmake
+
+	# need libssp_nonshared on some musl platforms (because of nodefaultlibs)
+	case "$XBPS_TARGET_MACHINE" in
+		ppc64*) ;;
+		ppc*-musl|i686-musl|mips*-musl)
+			vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \
+				${wrksrc}/libunwind/src/CMakeLists.txt
+			vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \
+				${wrksrc}/libcxxabi/src/CMakeLists.txt
+			vsed -i 's,#ssp,,' ${wrksrc}/libcxx/CMakeLists.txt
+			;;
+	esac
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64-musl) # some sanitizer currently only on x86_64 stuff needs backtrace
+			vsed -i 's,# Set common link flags.,list(APPEND SANITIZER_COMMON_LINK_LIBS execinfo),' \
+				${wrksrc}/compiler-rt/CMakeLists.txt
+			;;
+		arm*-musl|i686-musl) # sanitizer code is broken since it duplicates some libc bits
+			vsed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' \
+				${wrksrc}/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+}
+
+pre_configure() {
+	local triplet
+
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		ppc64*) ;;
+		mips*-musl|ppc*) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+		riscv64*) _arch="RISCV64";;
+	esac
+
+	triplet=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}
+
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${triplet}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${triplet}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+
+	# Install libcxxabi headers
+	vinstall ${wrksrc}/libcxxabi/include/__cxxabi_config.h 644 usr/include
+	vinstall ${wrksrc}/libcxxabi/include/cxxabi.h 644 usr/include
+
+	# Install libunwind headers
+	vinstall ${wrksrc}/libunwind/include/__libunwind_config.h 644 usr/include
+	vinstall ${wrksrc}/libunwind/include/libunwind.h 644 usr/include
+	vinstall ${wrksrc}/libunwind/include/unwind.h 644 usr/include
+	vinstall ${wrksrc}/libunwind/include/mach-o/compact_unwind_encoding.h \
+		644 usr/include/mach-o
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/include/clang-tidy
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/clang
+		vmove usr/share/man/man1/clang.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+		vmove usr/bin/ld64.lld*
+		vmove usr/share/doc/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+llvm-libunwind_package() {
+	short_desc+=" - libunwind"
+	pkg_install() {
+		vmove "usr/lib/libunwind.so.*"
+	}
+}
+
+llvm-libunwind-devel_package() {
+	short_desc+=" - libunwind - development files"
+	depends="llvm-libunwind>=${version}_${revision}"
+	conflicts="libunwind-devel>=0"
+	pkg_install() {
+		vmove usr/lib/libunwind.so
+		vmove usr/lib/libunwind.a
+		vmove "usr/include/*unwind*"
+		vmove usr/include/mach-o
+		vmove usr/share/doc/libunwind
+	}
+}
+
+libcxxabi_package() {
+	short_desc+=" - low level support for libc++"
+	pkg_install() {
+		vmove "usr/lib/libc++abi.so.*"
+	}
+}
+
+libcxxabi-devel_package() {
+	short_desc+=" - low level support for libc++ - development files"
+	depends="libcxxabi>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/libc++abi.so
+		vmove usr/lib/libc++abi.a
+		vmove "usr/include/*cxxabi*"
+	}
+}
+
+libcxx_package() {
+	short_desc+=" - C++ standard library"
+	pkg_install() {
+		vmove "usr/lib/libc++.so.*"
+	}
+}
+
+libcxx-devel_package() {
+	short_desc+=" - C++ standard library - development files"
+	depends="libcxx>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/libc++.so
+		vmove usr/lib/libc++.a
+		vmove usr/lib/libc++experimental.a
+		vmove usr/include/c++
+		vmove usr/share/doc/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libomp.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove usr/lib/libarcher.so
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/include/omp*.h"
+		vmove "usr/lib/clang/${version}/include/omp*.h"
+		vmove usr/share/man/man1/llvmopenmp.1
+		vmove usr/share/doc/openmp
+	}
+}
+
+libllvm13_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm13/update b/srcpkgs/llvm13/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm13/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

From 28fae1f59e6a4340360c4edfccc53fdbc47fe950 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Fri, 31 Dec 2021 16:23:17 +0200
Subject: [PATCH 02/31] llvm: update to 13.0.0

---
 srcpkgs/llvm/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index a92db6f94f9f..bcfee82098ff 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=12.0.0
+version=13.0.0
 revision=1
 build_style=meta
-depends="llvm12"
-replaces="llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm13"
+replaces="llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 49091a1a45ca9778e72603014330de2da4f7bf21 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Fri, 31 Dec 2021 16:43:56 +0200
Subject: [PATCH 03/31] llvm12: remove clang parts

---
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ---
 .../patches/clang-002-add-musl-triples.patch  | 110 -------
 .../clang-003-ppc64-dynamic-linker-path.patch |  13 -
 .../patches/clang-004-ppc64-musl-elfv2.patch  |  48 ---
 .../compiler-rt-aarch64-ucontext.patch        |  11 -
 .../compiler-rt-sanitizer-ppc64-musl.patch    |  35 --
 .../llvm12/patches/compiler-rt-size_t.patch   |  10 -
 .../patches/compiler-rt-xray-ppc64-musl.patch |  62 ----
 srcpkgs/llvm12/patches/libcxx-musl.patch      |  26 --
 srcpkgs/llvm12/patches/libcxx-ppc.patch       |  22 --
 .../llvm12/patches/libcxx-ssp-nonshared.patch |  11 -
 srcpkgs/llvm12/patches/libcxxabi-dl.patch     |  25 --
 srcpkgs/llvm12/patches/libunwind-ppc32.patch  |  63 ----
 srcpkgs/llvm12/patches/lldb-musl.patch        |  31 --
 .../llvm12/patches/ppc32-compiler-rt.patch    |  21 --
 srcpkgs/llvm12/template                       | 301 +-----------------
 16 files changed, 1 insertion(+), 832 deletions(-)
 delete mode 100644 srcpkgs/llvm12/patches/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm12/patches/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm12/patches/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm12/patches/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm12/patches/compiler-rt-aarch64-ucontext.patch
 delete mode 100644 srcpkgs/llvm12/patches/compiler-rt-sanitizer-ppc64-musl.patch
 delete mode 100644 srcpkgs/llvm12/patches/compiler-rt-size_t.patch
 delete mode 100644 srcpkgs/llvm12/patches/compiler-rt-xray-ppc64-musl.patch
 delete mode 100644 srcpkgs/llvm12/patches/libcxx-musl.patch
 delete mode 100644 srcpkgs/llvm12/patches/libcxx-ppc.patch
 delete mode 100644 srcpkgs/llvm12/patches/libcxx-ssp-nonshared.patch
 delete mode 100644 srcpkgs/llvm12/patches/libcxxabi-dl.patch
 delete mode 100644 srcpkgs/llvm12/patches/libunwind-ppc32.patch
 delete mode 100644 srcpkgs/llvm12/patches/lldb-musl.patch
 delete mode 100644 srcpkgs/llvm12/patches/ppc32-compiler-rt.patch

diff --git a/srcpkgs/llvm12/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm12/patches/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index e4eaa7783e7a..000000000000
--- a/srcpkgs/llvm12/patches/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/clang/lib/Headers/unwind.h
-+++ b/clang/lib/Headers/unwind.h
-@@ -9,9 +9,6 @@
- 
- /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
- 
--#ifndef __CLANG_UNWIND_H
--#define __CLANG_UNWIND_H
--
- #if defined(__APPLE__) && __has_include_next(<unwind.h>)
- /* Darwin (from 11.x on) provide an unwind.h. If that's available,
-  * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm12/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm12/patches/clang-002-add-musl-triples.patch
deleted file mode 100644
index 25688d40dbc2..000000000000
--- a/srcpkgs/llvm12/patches/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,110 +0,0 @@
---- a/clang/lib/Driver/ToolChains/Gnu.cpp
-+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
-@@ -2086,7 +2086,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2153,8 +2154,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-       "powerpc64-suse-linux", "powerpc-montavista-linuxspe"};
-   static const char *const PPCLELibDirs[] = {"/lib32", "/lib"};
-   static const char *const PPCLETriples[] = {"powerpcle-linux-gnu",
--                                             "powerpcle-unknown-linux-gnu",
--                                             "powerpcle-linux-musl"};
-+                                             "powerpcle-unknown-linux-gnu"};
- 
-   static const char *const PPC64LibDirs[] = {"/lib64", "/lib"};
-   static const char *const PPC64Triples[] = {
-@@ -2235,6 +2235,87 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPCLEMuslTriples[] = {"powerpcle-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppcle:
-+      LibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
-+      TripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      BiarchTripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      BiarchLibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
-+      BiarchTripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm12/patches/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm12/patches/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4ad6412d1e6c..000000000000
--- a/srcpkgs/llvm12/patches/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/clang/lib/Driver/ToolChains/Linux.cpp
-+++ b/clang/lib/Driver/ToolChains/Linux.cpp
-@@ -504,10 +504,6 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
--    Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
--    break;
-   case llvm::Triple::ppc64le:
-     LibDir = "lib64";
-     Loader =
diff --git a/srcpkgs/llvm12/patches/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm12/patches/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index 21fc8003c5f1..000000000000
--- a/srcpkgs/llvm12/patches/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,48 +0,0 @@
---- a/clang/lib/Basic/Targets/PPC.h
-+++ b/clang/lib/Basic/Targets/PPC.h
-@@ -415,11 +415,10 @@ public:
-       LongDoubleFormat = &llvm::APFloat::IEEEdouble();
-     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       DataLayout = "e-m:e-i64:64-n32:64";
--      ABI = "elfv2";
-     } else {
-       DataLayout = "E-m:e-i64:64-n32:64";
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) {
-       LongDoubleWidth = LongDoubleAlign = 64;
---- a/clang/lib/CodeGen/TargetInfo.cpp
-+++ b/clang/lib/CodeGen/TargetInfo.cpp
-@@ -10927,9 +10927,9 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
-       return SetCGInfo(new AIXTargetCodeGenInfo(Types, /*Is64Bit*/ true));
- 
-     if (Triple.isOSBinFormatELF()) {
--      PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv1;
--      if (getTarget().getABI() == "elfv2")
--        Kind = PPC64_SVR4_ABIInfo::ELFv2;
-+      PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv2;
-+      if (getTarget().getABI() == "elfv1")
-+        Kind = PPC64_SVR4_ABIInfo::ELFv1;
-       bool IsSoftFloat = CodeGenOpts.FloatABI == "soft";
- 
-       return SetCGInfo(
---- a/clang/lib/Driver/ToolChains/Clang.cpp
-+++ b/clang/lib/Driver/ToolChains/Clang.cpp
-@@ -1920,14 +1920,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-   const llvm::Triple &T = getToolChain().getTriple();
-   if (T.isOSBinFormatELF()) {
-     switch (getToolChain().getArch()) {
--    case llvm::Triple::ppc64: {
--      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
--          T.isOSOpenBSD() || T.isMusl())
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
--      break;
--    }
-+    case llvm::Triple::ppc64:
-     case llvm::Triple::ppc64le:
-       ABIName = "elfv2";
-       break;
diff --git a/srcpkgs/llvm12/patches/compiler-rt-aarch64-ucontext.patch b/srcpkgs/llvm12/patches/compiler-rt-aarch64-ucontext.patch
deleted file mode 100644
index 893c059d7b8d..000000000000
--- a/srcpkgs/llvm12/patches/compiler-rt-aarch64-ucontext.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp.orig
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
-@@ -1799,7 +1799,7 @@
- 
- static bool Aarch64GetESR(ucontext_t *ucontext, u64 *esr) {
-   static const u32 kEsrMagic = 0x45535201;
--  u8 *aux = ucontext->uc_mcontext.__reserved;
-+  u8 *aux = reinterpret_cast<u8 *>(ucontext->uc_mcontext.__reserved);
-   while (true) {
-     _aarch64_ctx *ctx = (_aarch64_ctx *)aux;
-     if (ctx->size == 0) break;
diff --git a/srcpkgs/llvm12/patches/compiler-rt-sanitizer-ppc64-musl.patch b/srcpkgs/llvm12/patches/compiler-rt-sanitizer-ppc64-musl.patch
deleted file mode 100644
index 35f16d24f340..000000000000
--- a/srcpkgs/llvm12/patches/compiler-rt-sanitizer-ppc64-musl.patch
+++ /dev/null
@@ -1,35 +0,0 @@
---- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
-@@ -74,6 +74,10 @@
- #include <sys/utsname.h>
- #endif
- 
-+#if SANITIZER_LINUX && defined(__powerpc__)
-+#include <asm/ptrace.h>
-+#endif
-+
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
- #include <sys/personality.h>
- #endif
---- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
-@@ -92,7 +92,7 @@
- # include <utime.h>
- # include <sys/ptrace.h>
- #if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
--    SANITIZER_RISCV64
-+    defined(__powerpc__) || SANITIZER_RISCV64
- #  include <asm/ptrace.h>
- #  ifdef __arm__
- typedef struct user_fpregs elf_fpregset_t;
---- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
-@@ -31,7 +31,7 @@
- #include <sys/types.h> // for pid_t
- #include <sys/uio.h> // for iovec
- #include <elf.h> // for NT_PRSTATUS
--#if (defined(__aarch64__) || SANITIZER_RISCV64) && !SANITIZER_ANDROID
-+#if (defined(__aarch64__) || defined(__powerpc__) || SANITIZER_RISCV64) && !SANITIZER_ANDROID
- // GLIBC 2.20+ sys/user does not include asm/ptrace.h
- # include <asm/ptrace.h>
- #endif
diff --git a/srcpkgs/llvm12/patches/compiler-rt-size_t.patch b/srcpkgs/llvm12/patches/compiler-rt-size_t.patch
deleted file mode 100644
index 2c63063a5e9e..000000000000
--- a/srcpkgs/llvm12/patches/compiler-rt-size_t.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp.orig
-+++ b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
-@@ -25,6 +25,7 @@
-   }
- 
- #include <cassert>
-+#include <cstddef>
- #include <cstdint>
- #include <dlfcn.h> // for dlsym()
- 
diff --git a/srcpkgs/llvm12/patches/compiler-rt-xray-ppc64-musl.patch b/srcpkgs/llvm12/patches/compiler-rt-xray-ppc64-musl.patch
deleted file mode 100644
index d0b61c80c897..000000000000
--- a/srcpkgs/llvm12/patches/compiler-rt-xray-ppc64-musl.patch
+++ /dev/null
@@ -1,62 +0,0 @@
---- a/compiler-rt/lib/xray/xray_powerpc64.inc
-+++ b/compiler-rt/lib/xray/xray_powerpc64.inc
-@@ -12,7 +12,13 @@
- 
- #include <cstdint>
- #include <mutex>
-+#ifdef __GLIBC__
- #include <sys/platform/ppc.h>
-+#else
-+#include <cctype>
-+#include <cstring>
-+#include <cstdlib>
-+#endif
- 
- #include "xray_defs.h"
- 
-@@ -20,13 +26,45 @@ namespace __xray {
- 
- ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
-   CPU = 0;
-+#ifdef __GLIBC__
-   return __ppc_get_timebase();
-+#else
-+  return __builtin_ppc_get_timebase();
-+#endif
- }
- 
- inline uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
-   static std::mutex M;
-   std::lock_guard<std::mutex> Guard(M);
-+#ifdef __GLIBC__
-   return __ppc_get_timebase_freq();
-+#else
-+  /* FIXME: a less dirty implementation? */
-+  static uint64_t base;
-+  if (!base) {
-+    FILE *f = fopen("/proc/cpuinfo", "rb");
-+    if (f) {
-+      ssize_t nr;
-+      /* virtually always big enough to hold the line */
-+      char buf[512];
-+      while (fgets(buf, sizeof(buf), f)) {
-+        char *ret = strstr(buf, "timebase");
-+        if (!ret) {
-+          continue;
-+        }
-+        ret += sizeof("timebase") - 1;
-+        ret = strchr(ret, ':');
-+        if (!ret) {
-+          continue;
-+        }
-+        base = strtoul(ret + 1, nullptr, 10);
-+        break;
-+      }
-+      fclose(f);
-+    }
-+  }
-+  return base;
-+#endif
- }
- 
- inline bool probeRequiredCPUFeatures() XRAY_NEVER_INSTRUMENT {
diff --git a/srcpkgs/llvm12/patches/libcxx-musl.patch b/srcpkgs/llvm12/patches/libcxx-musl.patch
deleted file mode 100644
index bbd31ffc2cb1..000000000000
--- a/srcpkgs/llvm12/patches/libcxx-musl.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/libcxx/include/locale
-+++ b/libcxx/include/locale
-@@ -742,7 +742,11 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
-         typename remove_reference<decltype(errno)>::type __save_errno = errno;
-         errno = 0;
-         char *__p2;
-+#if defined(__linux__) && !defined(__GLIBC__)
-+        long long __ll = strtoll(__a, &__p2, __base);
-+#else
-         long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
-+#endif
-         typename remove_reference<decltype(errno)>::type __current_errno = errno;
-         if (__current_errno == 0)
-             errno = __save_errno;
-@@ -782,7 +786,11 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
-         typename remove_reference<decltype(errno)>::type __save_errno = errno;
-         errno = 0;
-         char *__p2;
-+#if defined(__linux__) && !defined(__GLIBC__)
-+        unsigned long long __ll = strtoull(__a, &__p2, __base);
-+#else
-         unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
-+#endif
-         typename remove_reference<decltype(errno)>::type __current_errno = errno;
-         if (__current_errno == 0)
-             errno = __save_errno;
diff --git a/srcpkgs/llvm12/patches/libcxx-ppc.patch b/srcpkgs/llvm12/patches/libcxx-ppc.patch
deleted file mode 100644
index 7a92f8004e1c..000000000000
--- a/srcpkgs/llvm12/patches/libcxx-ppc.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-This ensures `is_iec559` is defined correctly under all long double ABIs,
-including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
-is not defined on gcc.
-
---- a/libcxx/include/limits
-+++ b/libcxx/include/limits
-@@ -426,8 +426,14 @@ protected:
-     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
-     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
- 
--#if (defined(__ppc__) || defined(__ppc64__))
-+#if defined(__powerpc__) || defined(__powerpc64__)
-+#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
-+    /* IEEE 754 quadruple or double precision */
-+    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
-+#else
-+    /* 128-bit IBM double-double */
-     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
-+#endif
- #else
-     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
- #endif
diff --git a/srcpkgs/llvm12/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm12/patches/libcxx-ssp-nonshared.patch
deleted file mode 100644
index 70292beb2fcd..000000000000
--- a/srcpkgs/llvm12/patches/libcxx-ssp-nonshared.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libcxx/CMakeLists.txt
-+++ b/libcxx/CMakeLists.txt
-@@ -769,6 +769,8 @@ function(cxx_link_system_libraries target)
-     target_link_libraries(${target} PRIVATE atomic)
-   endif()
- 
-+#ssp  target_link_libraries(${target} PRIVATE ssp_nonshared)
-+
-   if (MINGW)
-     target_link_libraries(${target} PRIVATE "${MINGW_LIBRARIES}")
-   endif()
diff --git a/srcpkgs/llvm12/patches/libcxxabi-dl.patch b/srcpkgs/llvm12/patches/libcxxabi-dl.patch
deleted file mode 100644
index 3a15f9db8c98..000000000000
--- a/srcpkgs/llvm12/patches/libcxxabi-dl.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Also link to -ldl to prevent undefined references.
-
---- a/libcxxabi/src/CMakeLists.txt
-+++ b/libcxxabi/src/CMakeLists.txt
-@@ -73,6 +73,7 @@
-   endif()
- 
-   add_library_flags_if(LIBCXXABI_HAS_C_LIB c)
-+  add_library_flags_if(LIBCXXABI_HAS_C_LIB dl)
- endif()
- 
- if (LIBCXXABI_USE_LLVM_UNWINDER)
---- a/libcxx/CMakeLists.txt
-+++ b/libcxx/CMakeLists.txt
-@@ -745,6 +745,10 @@
-     target_link_libraries(${target} PRIVATE m)
-   endif()
- 
-+  if (LIBCXX_HAS_C_LIB)
-+    target_link_libraries(${target} PRIVATE dl)
-+  endif()
-+
-   if (LIBCXX_HAS_RT_LIB)
-     target_link_libraries(${target} PRIVATE rt)
-   endif()
diff --git a/srcpkgs/llvm12/patches/libunwind-ppc32.patch b/srcpkgs/llvm12/patches/libunwind-ppc32.patch
deleted file mode 100644
index 74aa7576ecf9..000000000000
--- a/srcpkgs/llvm12/patches/libunwind-ppc32.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-This fixes build at least with gcc9 which does not define `__ppc__`.
-
---- a/libunwind/include/__libunwind_config.h
-+++ b/libunwind/include/__libunwind_config.h
-@@ -49,7 +49,7 @@
- #  define _LIBUNWIND_CONTEXT_SIZE 167
- #  define _LIBUNWIND_CURSOR_SIZE 179
- #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
--# elif defined(__ppc__)
-+# elif defined(__powerpc__)
- #  define _LIBUNWIND_TARGET_PPC 1
- #  define _LIBUNWIND_CONTEXT_SIZE 117
- #  define _LIBUNWIND_CURSOR_SIZE 124
---- a/libunwind/src/UnwindRegistersRestore.S
-+++ b/libunwind/src/UnwindRegistersRestore.S
-@@ -392,7 +392,7 @@ Lnovec:
-   PPC64_LR(3)
-   bctr
- 
--#elif defined(__ppc__)
-+#elif defined(__powerpc__)
- 
- DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
- //
---- a/libunwind/src/UnwindRegistersSave.S
-+++ b/libunwind/src/UnwindRegistersSave.S
-@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
-   blr
- 
- 
--#elif defined(__ppc__)
-+#elif defined(__powerpc__)
- 
- //
- // extern int unw_getcontext(unw_context_t* thread_state)
---- a/libunwind/src/config.h
-+++ b/libunwind/src/config.h
-@@ -95,12 +95,12 @@
- #define _LIBUNWIND_BUILD_SJLJ_APIS
- #endif
- 
--#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
- #define _LIBUNWIND_SUPPORT_FRAME_APIS
- #endif
- 
- #if defined(__i386__) || defined(__x86_64__) ||                                \
--    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
-+    defined(__powerpc__) || defined(__powerpc64__) ||                          \
-     (!defined(__APPLE__) && defined(__arm__)) ||                               \
-     (defined(__arm64__) || defined(__aarch64__)) ||                            \
-     defined(__mips__)
---- a/libunwind/src/libunwind.cpp
-+++ b/libunwind/src/libunwind.cpp
-@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
- # define REGISTER_KIND Registers_x86_64
- #elif defined(__powerpc64__)
- # define REGISTER_KIND Registers_ppc64
--#elif defined(__ppc__)
-+#elif defined(__powerpc__)
- # define REGISTER_KIND Registers_ppc
- #elif defined(__aarch64__)
- # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm12/patches/lldb-musl.patch b/srcpkgs/llvm12/patches/lldb-musl.patch
deleted file mode 100644
index 601c0d138523..000000000000
--- a/srcpkgs/llvm12/patches/lldb-musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/lldb/source/Plugins/Process/Linux/Procfs.h
-+++ b/lldb/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm12/patches/ppc32-compiler-rt.patch b/srcpkgs/llvm12/patches/ppc32-compiler-rt.patch
deleted file mode 100644
index 8e0a9a779d1b..000000000000
--- a/srcpkgs/llvm12/patches/ppc32-compiler-rt.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-commit ba4ede595ff9599232f5dd2b4384c243137b53fc
-Author: Daniel Kolesa <daniel@octaforge.org>
-Date:   Tue Jun 22 23:40:54 2021 +0200
-
-    enable compiler-rt support for ppc32
-
-diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
-index 1edab43..5c0c8a2 100644
---- a/compiler-rt/cmake/base-config-ix.cmake
-+++ b/compiler-rt/cmake/base-config-ix.cmake
-@@ -182,9 +182,7 @@ macro(test_targets)
-     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc64le")
-       test_target_arch(powerpc64le "" "-m64")
-     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc")
--      if(CMAKE_SYSTEM_NAME MATCHES "AIX")
--        test_target_arch(powerpc "" "-m32")
--      endif()
-+      test_target_arch(powerpc "" "-m32")
-       test_target_arch(powerpc64 "" "-m64")
-     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "s390x")
-       test_target_arch(s390x "" "")
diff --git a/srcpkgs/llvm12/template b/srcpkgs/llvm12/template
index 7ce18028e4a3..7b361bbbf5bc 100644
--- a/srcpkgs/llvm12/template
+++ b/srcpkgs/llvm12/template
@@ -1,25 +1,17 @@
 # Template file for 'llvm12'
 pkgname=llvm12
 version=12.0.1
-revision=2
+revision=3
 wrksrc="llvm-project-${version}.src"
 build_wrksrc=llvm
 build_style=cmake
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
- -DLLDB_USE_SYSTEM_SIX=YES
- -DLIBCXX_CXX_ABI=libcxxabi
- -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES
- -DLIBCXXABI_USE_LLVM_UNWINDER=YES
- -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
- -DLIBOMP_ENABLE_SHARED=YES
- -DLIBOMP_INSTALL_ALIASES=NO
  -DLLVM_INCLUDE_DOCS=YES
  -DLLVM_BUILD_DOCS=YES
  -DLLVM_ENABLE_SPHINX=YES
  -DSPHINX_WARNINGS_AS_ERRORS=NO
- -DLLVM_INSTALL_UTILS=YES
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DLLVM_ENABLE_RTTI=YES
@@ -51,87 +43,10 @@ case "$XBPS_TARGET_MACHINE" in
 	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
 esac
 
-_enabled_projects="clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;libunwind;lld"
-
-_lldb_enable=yes
-_libomp_enable=no
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*|i686*) _lldb_enable=no ;;
-esac
-
-case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
-esac
-
-subpackages="clang-tools-extra"
-
-# must go before clang
-if [ "$_libomp_enable" = "yes" ]; then
-	_enabled_projects+=";openmp"
-	subpackages+=" libomp libomp-devel"
-	# because of cmake nonsense referencing libomptarget.so.*
-	depends+=" libomp>=${version}_${revision}"
-fi
-
-subpackages+=" clang clang-analyzer libclang libclang-cpp
- llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
- libcxxabi libcxxabi-devel libllvm12"
-
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	_enabled_projects+=";lldb"
-	subpackages+=" lldb lldb-devel"
-fi
-
-subpackages+=" lld lld-devel"
-
-configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
-
 post_patch() {
-	if [ "$_lldb_enable" = "yes" ]; then
-		if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-			vsed -i 's|__ptrace_request|int|g' \
-				${wrksrc}/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
-		fi
-		# disable docs for lldb as they fail to generate
-		vsed -i '/add_subdirectory(docs)/d' \
-			${wrksrc}/lldb/CMakeLists.txt
-	fi
-
 	# update config.guess for better platform detection
 	cp $XBPS_COMMONDIR/environment/configure/automake/config.guess \
 		${wrksrc}/llvm/cmake
-
-	# fix linker failures on some archs
-	vsed -i 's,check_library_exists(gcc_s .*,set(LIBCXXABI_HAS_GCC_S_LIB ON),' \
-		${wrksrc}/libcxxabi/cmake/config-ix.cmake
-	vsed -i 's,check_library_exists(gcc .*,set(LIBCXXABI_HAS_GCC_LIB ON),' \
-		${wrksrc}/libcxxabi/cmake/config-ix.cmake
-
-	# need libssp_nonshared on some musl platforms (because of nodefaultlibs)
-	case "$XBPS_TARGET_MACHINE" in
-		ppc64*) ;;
-		ppc*-musl|i686-musl|mips*-musl)
-			vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \
-				${wrksrc}/libunwind/src/CMakeLists.txt
-			vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \
-				${wrksrc}/libcxxabi/src/CMakeLists.txt
-			vsed -i 's,#ssp,,' ${wrksrc}/libcxx/CMakeLists.txt
-			;;
-	esac
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64-musl) # some sanitizer currently only on x86_64 stuff needs backtrace
-			vsed -i 's,# Set common link flags.,list(APPEND SANITIZER_COMMON_LINK_LIBS execinfo),' \
-				${wrksrc}/compiler-rt/CMakeLists.txt
-			;;
-		arm*-musl|i686-musl) # sanitizer code is broken since it duplicates some libc bits
-			vsed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' \
-				${wrksrc}/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
 }
 
 pre_configure() {
@@ -158,10 +73,8 @@ pre_configure() {
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
 			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
 		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
 		cd ../..
 	fi
@@ -202,218 +115,6 @@ do_install() {
 	if [ "$CROSS_BUILD" ]; then
 		rm -f ${DESTDIR}/usr/bin/llvm-config-host
 	fi
-
-	# Install libcxxabi headers
-	vinstall ${wrksrc}/libcxxabi/include/__cxxabi_config.h 644 usr/include
-	vinstall ${wrksrc}/libcxxabi/include/cxxabi.h 644 usr/include
-
-	# Install libunwind headers
-	vinstall ${wrksrc}/libunwind/include/__libunwind_config.h 644 usr/include
-	vinstall ${wrksrc}/libunwind/include/libunwind.h 644 usr/include
-	vinstall ${wrksrc}/libunwind/include/unwind.h 644 usr/include
-	vinstall ${wrksrc}/libunwind/include/mach-o/compact_unwind_encoding.h \
-		644 usr/include/mach-o
-}
-
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3 perl"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/include/clang-tidy
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-		vmove usr/share/doc/clang-tools
-		vmove usr/share/man/man1/extraclangtools.1
-		vmove usr/share/man/man1/diagtool.1
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove usr/share/clang
-		vmove usr/share/doc/clang
-		vmove usr/share/man/man1/clang.1
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-		vmove usr/bin/ld64.lld*
-		vmove usr/share/doc/lld
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	depends="lld>=${version}_${revision}"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove usr/lib/cmake/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
-llvm-libunwind_package() {
-	short_desc+=" - libunwind"
-	pkg_install() {
-		vmove "usr/lib/libunwind.so.*"
-	}
-}
-
-llvm-libunwind-devel_package() {
-	short_desc+=" - libunwind - development files"
-	depends="llvm-libunwind>=${version}_${revision}"
-	conflicts="libunwind-devel>=0"
-	pkg_install() {
-		vmove usr/lib/libunwind.so
-		vmove usr/lib/libunwind.a
-		vmove "usr/include/*unwind*"
-		vmove usr/include/mach-o
-		vmove usr/share/doc/libunwind
-	}
-}
-
-libcxxabi_package() {
-	short_desc+=" - low level support for libc++"
-	pkg_install() {
-		vmove "usr/lib/libc++abi.so.*"
-	}
-}
-
-libcxxabi-devel_package() {
-	short_desc+=" - low level support for libc++ - development files"
-	depends="libcxxabi>=${version}_${revision}"
-	pkg_install() {
-		vmove usr/lib/libc++abi.so
-		vmove usr/lib/libc++abi.a
-		vmove "usr/include/*cxxabi*"
-	}
-}
-
-libcxx_package() {
-	short_desc+=" - C++ standard library"
-	pkg_install() {
-		vmove "usr/lib/libc++.so.*"
-	}
-}
-
-libcxx-devel_package() {
-	short_desc+=" - C++ standard library - development files"
-	depends="libcxx>=${version}_${revision}"
-	pkg_install() {
-		vmove usr/lib/libc++.so
-		vmove usr/lib/libc++.a
-		vmove usr/lib/libc++experimental.a
-		vmove usr/include/c++
-		vmove usr/share/doc/libcxx
-	}
-}
-
-libomp_package() {
-	short_desc+=" - Clang OpenMP support library"
-	pkg_install() {
-		vmove usr/lib/libomp.so
-		vmove "usr/lib/libomptarget.rtl.*.so"
-		vmove usr/lib/libarcher.so
-		vmove "usr/lib/libomp*.so.*"
-	}
-}
-
-libomp-devel_package() {
-	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
-	pkg_install() {
-		vmove "usr/lib/libomp*.so"
-		vmove "usr/lib/libarcher*"
-		vmove "usr/include/omp*.h"
-		vmove "usr/lib/clang/${version}/include/omp*.h"
-		vmove usr/share/man/man1/llvmopenmp.1
-		vmove usr/share/doc/openmp
-	}
 }
 
 libllvm12_package() {

From 2023392861664d9ede048f9f478449307a04881a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 15:57:59 +0200
Subject: [PATCH 04/31] rtags: rebuild for llvm13

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index b496a1b0e721..9b161e690d76 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=5
+revision=6
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From d029d4697cfc6cb79e01b4d56b7aa1e05b0e151c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 15:58:27 +0200
Subject: [PATCH 05/31] bpftrace: rebuild for llvm13

---
 srcpkgs/bpftrace/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index 28ab3c626399..eb2480d2230e 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.14.1
-revision=1
+revision=2
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run

From b34902cdc3a730cc6ded3002fe17e9b8f1786afd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 15:58:38 +0200
Subject: [PATCH 06/31] clazy: rebuild for llvm13

---
 srcpkgs/clazy/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 11f3bab55aef..f81de08ab836 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.11
-revision=1
+revision=2
 build_style=cmake
 build_helper=qemu
 hostmakedepends="llvm"

From 06b229b82f123929c612236b8331a7c7472e5e4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 15:58:49 +0200
Subject: [PATCH 07/31] ccls: rebuild for llvm13

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index fbb7c6847bc1..40aba3b55bfe 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20210330
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="llvm ncurses-devel rapidjson zlib-devel clang-tools-extra"

From 62f72d92dd11adc1120c65dda3cda6023d2ea8ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 15:59:35 +0200
Subject: [PATCH 08/31] include-what-you-use: rebuild for llvm13

---
 srcpkgs/include-what-you-use/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index b13bb7ee56af..b4b167401ebe 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,6 +1,6 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
-version=0.16
+version=0.17
 revision=1
 wrksrc="${pkgname}"
 build_style=cmake
@@ -12,7 +12,7 @@ maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="NCSA"
 homepage="https://include-what-you-use.org/"
 distfiles="https://include-what-you-use.org/downloads/${pkgname}-${version}.src.tar.gz"
-checksum=8d6fc9b255343bc1e5ec459e39512df1d51c60e03562985e0076036119ff5a1c
+checksum=eca7c04f8b416b6385ed00e33669a7fa4693cd26cb72b522cde558828eb0c665
 python_version=3
 
 post_install() {

From 9eb584e6d320fbc58e305a202f53b2da1a94ebbe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 16:01:21 +0200
Subject: [PATCH 09/31] codelite: rebuild for llvm13

---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index 3a993a2c0cfb..24e2c879dd45 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=15.0.6
-revision=1
+revision=2
 build_style=cmake
 build_helper=cmake-wxWidgets-gtk3
 configure_args="-DWITH_PCH=0 -DWITH_WX_CONFIG=wx-config-gtk3

From 4a211d5a9dbd20eb7d63569f1449a2a20a94f140 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 16:22:48 +0200
Subject: [PATCH 10/31] kdevelop: rebuild for llvm13

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 010185849d80..abf08c313071 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=21.12.3
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From a7d32d2e0788bf52f6b7c9056f6e9d92277ef4d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 16:23:07 +0200
Subject: [PATCH 11/31] juCi++: rebuild for llvm13

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 1a7604b44a00..5103324dec20 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.2
-revision=2
+revision=3
 _libclangmm_commit="b342f4dd6de4fe509a692a4b4fcfc7e24aae9590"
 _tiny_commit="c9c8bf810ddad8cd17882b9a9ee628a690e779f5"
 wrksrc="jucipp-v${version}"

From 31510eaabbf90cf9c668fb6da4051d6990f40563 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sat, 1 Jan 2022 18:30:01 +0200
Subject: [PATCH 12/31] llvm13: fix libomp* packages

---
 srcpkgs/llvm13/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm13/template b/srcpkgs/llvm13/template
index 08d847472525..bfc91056d277 100644
--- a/srcpkgs/llvm13/template
+++ b/srcpkgs/llvm13/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm13'
 pkgname=llvm13
 version=13.0.0
-revision=1
+revision=2
 wrksrc="llvm-project-${version}.src"
 build_wrksrc=llvm
 build_style=cmake
@@ -397,6 +397,7 @@ libomp_package() {
 	short_desc+=" - Clang OpenMP support library"
 	pkg_install() {
 		vmove usr/lib/libomp.so
+		vmove usr/lib/libomptarget.so
 		vmove "usr/lib/libomptarget.rtl.*.so"
 		vmove usr/lib/libarcher.so
 	}
@@ -406,7 +407,6 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision}"
 	pkg_install() {
-		vmove "usr/lib/libomp*.so"
 		vmove "usr/lib/libarcher*"
 		vmove "usr/include/omp*.h"
 		vmove "usr/lib/clang/${version}/include/omp*.h"

From 23b6e256afbaa6cd886f6cbb4d67c8df447f5bab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sun, 16 Jan 2022 14:33:56 +0200
Subject: [PATCH 13/31] chromium: rebuild for llvm13

---
 srcpkgs/chromium/template | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index f6154e223751..1edf61a3398f 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -20,7 +20,7 @@ desc_option_debug="Build with debug symbols"
 desc_option_js_optimize="Optimize the JS used for Chromium's UI"
 desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
 
-hostmakedepends="$(vopt_if clang "clang lld llvm12") python python3 pkgconf perl gperf bison ninja nodejs hwids
+hostmakedepends="$(vopt_if clang "clang lld llvm13") python python3 pkgconf perl gperf bison ninja nodejs hwids
  libatomic-devel libevent-devel libglib-devel $(vopt_if js_optimize openjdk) wayland-devel libepoxy-devel"
 makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
@@ -266,12 +266,6 @@ do_configure() {
 		'disable_fieldtrial_testing_config=true'
 
 		'is_official_build=true'
-
-		# segfaults with llvm-12.0.1
-		'is_cfi=false'
-		'use_thin_lto=false'
-		'use_cfi_icall=false'
-		'chrome_pgo_phase=0'
 	)
 
 	if [ "$CROSS_BUILD" ]; then

From cd7d3e9fc799b9d211fe54174688cd02d1db52af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?=
 <louisdb@lespetitspedestres.org>
Date: Sun, 16 Jan 2022 14:39:04 +0200
Subject: [PATCH 14/31] llvm12: remove

---
 srcpkgs/llvm12/INSTALL.msg                    |   1 +
 .../llvm12/files/llvm-Config-llvm-config.h    |   9 --
 srcpkgs/llvm12/patches/llvm-001-musl.patch    |  57 ---------
 .../patches/llvm-002-musl-ppc64-elfv2.patch   |  30 -----
 .../patches/llvm-003-ppc-secureplt.patch      |  11 --
 .../patches/llvm-004-override-opt.patch       |  18 ---
 .../llvm12/patches/llvm-005-ppc-bigpic.patch  |  36 ------
 .../patches/llvm-006-aarch64-mf_exec.patch    |  25 ----
 srcpkgs/llvm12/template                       | 120 +-----------------
 srcpkgs/llvm12/update                         |   3 -
 10 files changed, 5 insertions(+), 305 deletions(-)
 create mode 100644 srcpkgs/llvm12/INSTALL.msg
 delete mode 100644 srcpkgs/llvm12/files/llvm-Config-llvm-config.h
 delete mode 100644 srcpkgs/llvm12/patches/llvm-001-musl.patch
 delete mode 100644 srcpkgs/llvm12/patches/llvm-002-musl-ppc64-elfv2.patch
 delete mode 100644 srcpkgs/llvm12/patches/llvm-003-ppc-secureplt.patch
 delete mode 100644 srcpkgs/llvm12/patches/llvm-004-override-opt.patch
 delete mode 100644 srcpkgs/llvm12/patches/llvm-005-ppc-bigpic.patch
 delete mode 100644 srcpkgs/llvm12/patches/llvm-006-aarch64-mf_exec.patch
 delete mode 100644 srcpkgs/llvm12/update

diff --git a/srcpkgs/llvm12/INSTALL.msg b/srcpkgs/llvm12/INSTALL.msg
new file mode 100644
index 000000000000..004acf7b530c
--- /dev/null
+++ b/srcpkgs/llvm12/INSTALL.msg
@@ -0,0 +1 @@
+llvm12 is no longer provided by Void Linux
diff --git a/srcpkgs/llvm12/files/llvm-Config-llvm-config.h b/srcpkgs/llvm12/files/llvm-Config-llvm-config.h
deleted file mode 100644
index 2fa08c9be696..000000000000
--- a/srcpkgs/llvm12/files/llvm-Config-llvm-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "llvm-config-32.h"
-#elif __WORDSIZE == 64
-#include "llvm-config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm12/patches/llvm-001-musl.patch b/srcpkgs/llvm12/patches/llvm-001-musl.patch
deleted file mode 100644
index f2a3f8d62813..000000000000
--- a/srcpkgs/llvm12/patches/llvm-001-musl.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:03:02 +0200
-Subject: [PATCH 3/3] musl
-
----
- include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
- lib/Support/DynamicLibrary.cpp            | 2 +-
- lib/Support/Unix/Signals.inc              | 6 +++---
- utils/unittest/googletest/src/gtest.cc    | 1 +
- 5 files changed, 17 insertions(+), 6 deletions(-)
-
-diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
-index 34a8a1e3..1214ece5 100644
---- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
-+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
-@@ -18,6 +18,15 @@
- #include "llvm/IR/PassManager.h"
- #include "llvm/Pass.h"
- 
-+#undef fopen64
-+#undef fseeko64
-+#undef fstat64
-+#undef fstatvfs64
-+#undef ftello64
-+#undef lstat64
-+#undef stat64
-+#undef tmpfile64
-+
- namespace llvm {
- template <typename T> class ArrayRef;
- class Triple;
-diff --git a/lib/Support/Unix/DynamicLibrary.inc b/lib/Support/Unix/DynamicLibrary.inc
-index a2a37996..2f86c470 100644
---- a/llvm/lib/Support/Unix/DynamicLibrary.inc
-+++ b/llvm/lib/Support/Unix/DynamicLibrary.inc
-@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
- 
- // This macro returns the address of a well-known, explicit symbol
- #define EXPLICIT_SYMBOL(SYM) \
--   if (!strcmp(SymbolName, #SYM)) return &SYM
-+   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
- 
- // Under glibc we have a weird situation. The stderr/out/in symbols are both
- // macros and global variables because of standards requirements. So, we
-diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
-index d882ab2e..f1fb12d0 100644
---- a/llvm/utils/unittest/googletest/src/gtest.cc
-+++ b/llvm/utils/unittest/googletest/src/gtest.cc
-@@ -128,6 +128,7 @@
- 
- #if GTEST_CAN_STREAM_RESULTS_
- # include <arpa/inet.h>  // NOLINT
-+# include <sys/socket.h>  // NOLINT
- # include <netdb.h>  // NOLINT
- # include <sys/socket.h>  // NOLINT
- # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm12/patches/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm12/patches/llvm-002-musl-ppc64-elfv2.patch
deleted file mode 100644
index 0071d964bd37..000000000000
--- a/srcpkgs/llvm12/patches/llvm-002-musl-ppc64-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
-need this because unlike most distros we use ELFv2 for both glibc and musl
-on big endian ppc64.
-
-diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp
-index 0634833e..b7cbc2e7 100644
---- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
-+++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
-@@ -222,9 +222,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
- 
-   switch (TT.getArch()) {
-   case Triple::ppc64le:
--    return PPCTargetMachine::PPC_ABI_ELFv2;
-   case Triple::ppc64:
--    return PPCTargetMachine::PPC_ABI_ELFv1;
-+    return PPCTargetMachine::PPC_ABI_ELFv2;
-   default:
-     return PPCTargetMachine::PPC_ABI_UNKNOWN;
-   }
-diff --git a/test/CodeGen/PowerPC/ppc64-elf-abi.ll b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
-index 8b1cf6b5..296a2afa 100644
---- a/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
-+++ b/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
-@@ -1,4 +1,5 @@
--; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
-+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
-+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
- ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
- ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
- ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm12/patches/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm12/patches/llvm-003-ppc-secureplt.patch
deleted file mode 100644
index b5d15974375d..000000000000
--- a/srcpkgs/llvm12/patches/llvm-003-ppc-secureplt.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-+++ b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -165,7 +165,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
-   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
-       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
--      TargetTriple.isMusl())
-+      isTargetLinux())
-     SecurePlt = true;
- 
-   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm12/patches/llvm-004-override-opt.patch b/srcpkgs/llvm12/patches/llvm-004-override-opt.patch
deleted file mode 100644
index 51d0e4b31b32..000000000000
--- a/srcpkgs/llvm12/patches/llvm-004-override-opt.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-This allows us to override the optimization level as not all platforms can
-deal with -O3.
-
---- a/llvm/CMakeLists.txt
-+++ b/llvm/CMakeLists.txt
-@@ -918,6 +918,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
-   llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
- endif()
- 
-+set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
-+
-+if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
-+    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
-+endif()
-+
- # Put this before tblgen. Else we have a circular dependence.
- add_subdirectory(lib/Demangle)
- add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm12/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm12/patches/llvm-005-ppc-bigpic.patch
deleted file mode 100644
index d332687b9d92..000000000000
--- a/srcpkgs/llvm12/patches/llvm-005-ppc-bigpic.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
-From: Samuel Holland <samuel@sholland.org>
-Date: Sun, 3 Nov 2019 10:57:27 -0600
-Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
-
----
- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
-index cce21f32..87ca5f9b 100644
---- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
-+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
-@@ -520,7 +520,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
- 
-   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
-   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
--      M->getPICLevel() == PICLevel::BigPIC)
-+      M->getPICLevel() != PICLevel::SmallPIC)
-     TlsRef = MCBinaryExpr::createAdd(
-         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
-   const MachineOperand &MO = MI->getOperand(2);
-diff --git a/lib/Target/PowerPC/PPCMCInstLower.cpp b/lib/Target/PowerPC/PPCMCInstLower.cpp
-index 5cc180d7..a5b02565 100644
---- a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
-+++ b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
-@@ -117,7 +117,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
-   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
-   // If -msecure-plt -fPIC, add 32768 to symbol.
-   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
--      M->getPICLevel() == PICLevel::BigPIC &&
-+      M->getPICLevel() != PICLevel::SmallPIC &&
-       MO.getTargetFlags() == PPCII::MO_PLT)
-     Expr =
-         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
diff --git a/srcpkgs/llvm12/patches/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm12/patches/llvm-006-aarch64-mf_exec.patch
deleted file mode 100644
index a00abd216665..000000000000
--- a/srcpkgs/llvm12/patches/llvm-006-aarch64-mf_exec.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
-
-    Failing Tests (8):
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
-        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
-
-Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
-
---- a/llvm/lib/Support/Unix/Memory.inc
-+++ b/llvm/lib/Support/Unix/Memory.inc
-@@ -58,7 +58,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
-     return PROT_READ | PROT_WRITE | PROT_EXEC;
-   case llvm::sys::Memory::MF_EXEC:
- #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
--     defined(_POWER) || defined(_ARCH_PPC))
-+     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
-     // On PowerPC, having an executable page that has no read permission
-     // can have unintended consequences.  The function InvalidateInstruction-
-     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm12/template b/srcpkgs/llvm12/template
index 7b361bbbf5bc..e7e40cae413e 100644
--- a/srcpkgs/llvm12/template
+++ b/srcpkgs/llvm12/template
@@ -1,125 +1,13 @@
 # Template file for 'llvm12'
 pkgname=llvm12
 version=12.0.1
-revision=3
-wrksrc="llvm-project-${version}.src"
-build_wrksrc=llvm
-build_style=cmake
-configure_args="
- -DCMAKE_BUILD_TYPE=Release -Wno-dev
- -DENABLE_LINKER_BUILD_ID=YES
- -DLLVM_INCLUDE_DOCS=YES
- -DLLVM_BUILD_DOCS=YES
- -DLLVM_ENABLE_SPHINX=YES
- -DSPHINX_WARNINGS_AS_ERRORS=NO
- -DLLVM_BUILD_LLVM_DYLIB=YES
- -DLLVM_LINK_LLVM_DYLIB=YES
- -DLLVM_ENABLE_RTTI=YES
- -DLLVM_ENABLE_FFI=YES
- -DLLVM_BINUTILS_INCDIR=/usr/include"
-hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
- python3-recommonmark python3-sphinx-automodapi"
-makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
- libxml2-devel binutils-devel libatomic-devel"
-depends="libllvm12>=${version}_${revision}"
-short_desc="Low Level Virtual Machine"
+revision=4
+build_style=meta
+short_desc="Low Level Virtual Machine (removed package)"
 maintainer="q66 <daniel@octaforge.org>"
-license="Apache-2.0"
+license="metapackage"
 homepage="https://www.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
-checksum=129cb25cd13677aad951ce5c2deb0fe4afc1e9d98950f53b51bdcfb5a73afa0e
-lib32disabled=yes
-python_version=3
-
-if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
-	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
-	makedepends+=" libexecinfo-devel"
-	depends+=" libexecinfo-devel"
-fi
-
-# "operand out of range" assembler failures
-case "$XBPS_TARGET_MACHINE" in
-	ppc64*) ;;
-	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
-esac
-
-post_patch() {
-	# update config.guess for better platform detection
-	cp $XBPS_COMMONDIR/environment/configure/automake/config.guess \
-		${wrksrc}/llvm/cmake
-}
-
-pre_configure() {
-	local triplet
-
-	# Vastly reduce size of debugging symbols:
-	CFLAGS=${CFLAGS/ -g/ -g1}
-	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
-
-	# since gcc9, the build likes to blow up for ppc32 apparently because
-	# of clang being too large for a 24-bit relative call to the PLT, so
-	# optimize for size instead
-	case "$XBPS_TARGET_MACHINE" in
-		ppc64*) ;;
-		mips*-musl|ppc*) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
-	esac
-
-	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-		make ${makejobs} -C utils/TableGen
-		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-		cd ../..
-	fi
-
-	case "$XBPS_TARGET_MACHINE" in
-		i686*) _arch="X86";;
-		x86_64*) _arch="X86";;
-		armv5*) _arch="Armv5te";;
-		armv6*) _arch="Armv6";;
-		armv7*) _arch="Armv7";;
-		aarch64*) _arch="AArch64";;
-		mips*) _arch="Mips";;
-		ppc*) _arch="PowerPC";;
-		riscv64*) _arch="RISCV64";;
-	esac
-
-	triplet=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}
-
-	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
-	configure_args+=" -DLLVM_HOST_TRIPLE=${triplet}"
-	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${triplet}"
-}
-
-do_install() {
-	cd build
-	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
-
-	# Required for multilib.
-	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
-		for _header in llvm-config; do
-			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
-			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
-				usr/include/llvm/Config ${_header}.h
-		done
-	fi
-
-	# Remove llvm-config-host in cross builds.
-	if [ "$CROSS_BUILD" ]; then
-		rm -f ${DESTDIR}/usr/bin/llvm-config-host
-	fi
-}
 
 libllvm12_package() {
 	short_desc+=" - runtime library"
-	pkg_install() {
-		vmove "usr/lib/libLLVM-*.so*"
-	}
 }
diff --git a/srcpkgs/llvm12/update b/srcpkgs/llvm12/update
deleted file mode 100644
index e95cf26b3586..000000000000
--- a/srcpkgs/llvm12/update
+++ /dev/null
@@ -1,3 +0,0 @@
-site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
-ignore="*-rc*"

From b01be1ced4d447065805ababae2462530961c8a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 28 Feb 2022 21:42:55 +0000
Subject: [PATCH 15/31] mesa: rebuild for llvm13

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index c90500de7416..8f08262fb135 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=21.3.7
-revision=1
+revision=2
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled

From 4fd7a767396209955c295a47e83835ca9f640abe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 28 Feb 2022 21:43:56 +0000
Subject: [PATCH 16/31] qtcreator: update to 6.0.2.

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 988491ec6496..b166cc05a999 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -5,7 +5,7 @@ revision=1
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"
-hostmakedepends="clang llvm perl pkg-config python3 which qt5-qmake
+hostmakedepends="llvm13 perl pkg-config python3 which qt5-qmake
  qt5-host-tools"
 makedepends="qt5-declarative-devel qt5-script-devel qt5-tools-devel
  qt5-quickcontrols qt5-svg-devel clang llvm"

From 578b3969aadd358d0bc57c0915b9e2921d6cff2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= <acerqueira021@gmail.com>
Date: Mon, 28 Feb 2022 21:46:48 +0000
Subject: [PATCH 17/31] ispc: update to 1.17.0.

---
 .../ispc/patches/cmake-build-type-none.patch  |   18 -
 srcpkgs/ispc/patches/llvm12-001.patch         |   57 -
 srcpkgs/ispc/patches/llvm12-002.patch         |  923 --------
 srcpkgs/ispc/patches/llvm12-003.patch         | 1504 ------------
 srcpkgs/ispc/patches/llvm12-004.patch         |   34 -
 srcpkgs/ispc/patches/llvm12-005.patch         |  372 ---
 srcpkgs/ispc/patches/llvm12-006.patch         |  126 -
 srcpkgs/ispc/patches/llvm12-007.patch         |  160 --
 srcpkgs/ispc/patches/llvm12-008.patch         |  149 --
 srcpkgs/ispc/patches/llvm12-009.patch         | 2109 -----------------
 srcpkgs/ispc/template                         |    8 +-
 11 files changed, 4 insertions(+), 5456 deletions(-)
 delete mode 100644 srcpkgs/ispc/patches/cmake-build-type-none.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-001.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-002.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-003.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-004.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-005.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-006.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-007.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-008.patch
 delete mode 100644 srcpkgs/ispc/patches/llvm12-009.patch

diff --git a/srcpkgs/ispc/patches/cmake-build-type-none.patch b/srcpkgs/ispc/patches/cmake-build-type-none.patch
deleted file mode 100644
index 411e353c7314..000000000000
--- a/srcpkgs/ispc/patches/cmake-build-type-none.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Index: ispc-1.15.0/CMakeLists.txt
-===================================================================
---- ispc-1.15.0.orig/CMakeLists.txt
-+++ ispc-1.15.0/CMakeLists.txt
-@@ -157,13 +157,6 @@ set(OUTPUT_RELEASE Release/bin)
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin )
- 
- if(CMAKE_BUILD_TYPE)
--    # Validate build type
--    set(CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo")
--
--    string(FIND "${CONFIGURATION_TYPES}" "${CMAKE_BUILD_TYPE}" MATCHED_CONFIG)
--    if (${MATCHED_CONFIG} EQUAL -1)
--         message(FATAL_ERROR "CMAKE_BUILD_TYPE (${CMAKE_BUILD_TYPE}) allows only the following values: ${CONFIGURATION_TYPES}")
--    endif()
- else(NOT CMAKE_BUILD_TYPE)
-     set(CMAKE_BUILD_TYPE "Release")
-     message(STATUS "Build type not specified: Use Release by default.")
diff --git a/srcpkgs/ispc/patches/llvm12-001.patch b/srcpkgs/ispc/patches/llvm12-001.patch
deleted file mode 100644
index 5f2d3f5a409e..000000000000
--- a/srcpkgs/ispc/patches/llvm12-001.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 1c0f89dccb774f216c7f6e76a99ee907a1e641cb Mon Sep 17 00:00:00 2001
-From: Dmitry Babokin <dmitry.y.babokin@intel.com>
-Date: Tue, 22 Dec 2020 17:03:59 -0800
-Subject: [PATCH] Fix to work with LLVM trunk after llvm/llvm-project@41c3b2713
-
----
- src/ctx.cpp | 18 ++++++++++++------
- 1 file changed, 12 insertions(+), 6 deletions(-)
-
-diff --git a/src/ctx.cpp b/src/ctx.cpp
-index 6fbb8b9cf..977e9d222 100644
---- a/src/ctx.cpp
-+++ b/src/ctx.cpp
-@@ -1473,11 +1473,15 @@ void FunctionEmitContext::AddDebugPos(llvm::Value *value, const SourcePos *pos,
-     llvm::Instruction *inst = llvm::dyn_cast<llvm::Instruction>(value);
-     if (inst != NULL && m->diBuilder) {
-         SourcePos p = pos ? *pos : currentPos;
--        if (p.first_line != 0)
-+        if (p.first_line != 0) {
-             // If first_line == 0, then we're in the middle of setting up
-             // the standard library or the like; don't add debug positions
-             // for those functions
--            inst->setDebugLoc(llvm::DebugLoc::get(p.first_line, p.first_column, scope ? scope : GetDIScope()));
-+            scope = scope ? scope : GetDIScope();
-+            llvm::DebugLoc diLoc =
-+                llvm::DILocation::get(scope->getContext(), p.first_line, p.first_column, scope, nullptr, false);
-+            inst->setDebugLoc(diLoc);
-+        }
-     }
- }
- 
-@@ -1518,9 +1522,10 @@ void FunctionEmitContext::EmitVariableDebugInfo(Symbol *sym) {
-     llvm::DILocalVariable *var = m->diBuilder->createAutoVariable(
-         scope, sym->name, sym->pos.GetDIFile(), sym->pos.first_line, diType, true /* preserve through opts */);
- 
-+    llvm::DebugLoc diLoc =
-+        llvm::DILocation::get(scope->getContext(), sym->pos.first_line, sym->pos.first_column, scope, nullptr, false);
-     llvm::Instruction *declareInst =
--        m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(),
--                                    llvm::DebugLoc::get(sym->pos.first_line, sym->pos.first_column, scope), bblock);
-+        m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(), diLoc, bblock);
-     AddDebugPos(declareInst, &sym->pos, scope);
- }
- 
-@@ -1535,9 +1540,10 @@ void FunctionEmitContext::EmitFunctionParameterDebugInfo(Symbol *sym, int argNum
-         m->diBuilder->createParameterVariable(scope, sym->name, argNum + 1, sym->pos.GetDIFile(), sym->pos.first_line,
-                                               diType, true /* preserve through opts */, flags);
- 
-+    llvm::DebugLoc diLoc =
-+        llvm::DILocation::get(scope->getContext(), sym->pos.first_line, sym->pos.first_column, scope, nullptr, false);
-     llvm::Instruction *declareInst =
--        m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(),
--                                    llvm::DebugLoc::get(sym->pos.first_line, sym->pos.first_column, scope), bblock);
-+        m->diBuilder->insertDeclare(sym->storagePtr, var, m->diBuilder->createExpression(), diLoc, bblock);
-     AddDebugPos(declareInst, &sym->pos, scope);
- }
- 
diff --git a/srcpkgs/ispc/patches/llvm12-002.patch b/srcpkgs/ispc/patches/llvm12-002.patch
deleted file mode 100644
index 0903f30da10d..000000000000
--- a/srcpkgs/ispc/patches/llvm12-002.patch
+++ /dev/null
@@ -1,923 +0,0 @@
-From 0597a79d084c014780136da906afe21d15e982cb Mon Sep 17 00:00:00 2001
-From: DeepakRajendrakumaran <deepak.rajendrakumaran@intel.com>
-Date: Tue, 5 Jan 2021 13:53:30 -0800
-Subject: [PATCH] Remove LLVM 8.0 and LLVM 9.0. (#1966)
-
----
- .appveyor.yml                        |  3 --
- .travis.yml                          |  7 ---
- CMakeLists.txt                       | 12 ++----
- src/ast.cpp                          |  4 --
- src/ctx.cpp                          | 30 -------------
- src/gen/GlobalsLocalization.cpp      |  4 --
- src/ispc.cpp                         | 20 ---------
- src/ispc.h                           |  3 +-
- src/ispc_version.h                   |  4 +-
- src/main.cpp                         | 13 ------
- src/module.cpp                       | 27 ------------
- src/module.h                         |  2 -
- src/opt.cpp                          | 64 ++--------------------------
- src/type.cpp                         | 10 ++---
- tests/lit-tests/1771.ispc            |  1 -
- tests/lit-tests/1844.ispc            |  3 --
- tests/lit-tests/1926.ispc            |  2 -
- tests/lit-tests/cpus_x86.ispc        |  2 +
- tests/lit-tests/cpus_x86_llvm10.ispc | 11 -----
- tests/lit-tests/lit.cfg              |  5 ---
- 20 files changed, 14 insertions(+), 213 deletions(-)
- delete mode 100644 tests/lit-tests/cpus_x86_llvm10.ispc
-
-diff --git a/.appveyor.yml b/.appveyor.yml
-index 451a7b3e0..7945cca2a 100644
---- a/.appveyor.yml
-+++ b/.appveyor.yml
-@@ -41,8 +41,6 @@ environment:
-       LLVM_VERSION: latest
-     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
-       LLVM_VERSION: 10.0
--    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
--      LLVM_VERSION: 9.0
- 
- for:
- -
-@@ -62,7 +60,6 @@ for:
-         if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" ( (set generator="Visual Studio 16") & (set vsversion=2019))
-         set LLVM_TAR=llvm-11.0.0-win.vs2019-Release+Asserts-x86.arm.wasm.7z
-         if "%LLVM_VERSION%"=="10.0" (set LLVM_TAR=llvm-10.0.1-win.vs2019-Release+Asserts-x86.arm.wasm.zip)
--        if "%LLVM_VERSION%"=="9.0" (set LLVM_TAR=llvm-9.0.1-win.vs2017-Release+Asserts-x86.arm.wasm.zip)
-   install:
-     - ps: choco install --no-progress winflexbison3 wget 7zip
-     - cmd: |-
-diff --git a/.travis.yml b/.travis.yml
-index 2e96017a6..3a6b85264 100644
---- a/.travis.yml
-+++ b/.travis.yml
-@@ -108,13 +108,6 @@ jobs:
-         - LLVM_TAR=llvm-10.0.1-ubuntu16.04-Release+Asserts-x86.arm.wasm.tar.xz
-         - LLVM_REPO=https://github.com/dbabokin/llvm-project
-         - ISPC_HOME=$TRAVIS_BUILD_DIR
--    # LLVM 9.0 + Ubuntu 16.04: build, lit tests, examples (build + run), benchmarks (build + trial run)
--    - <<: *my_tag
--      env:
--        - LLVM_VERSION=9.0 OS=Ubuntu16.04
--        - LLVM_TAR=llvm-9.0.1-ubuntu16.04-Release+Asserts-x86.arm.wasm.tar.xz
--        - LLVM_REPO=https://github.com/dbabokin/llvm-project
--        - ISPC_HOME=$TRAVIS_BUILD_DIR
-     # WASM enabled build
-     # LLVM 11.0 + Ubuntu 16.04: build, lit tests, examples (build), benchmarks (build + trial run)
-     - <<: *my_tag
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 5fa863fcf..a6b3ed251 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -241,10 +241,8 @@ if (X86_ENABLED)
-         avx2-i8x32 avx2-i16x16
-         avx2-i32x4 avx2-i32x8 avx2-i32x16 avx2-i64x4
-         avx512knl-i32x16
--        avx512skx-i32x16 avx512skx-i32x8)
--    if (${LLVM_VERSION_NUMBER} VERSION_GREATER_EQUAL "10.0.0")
--        list(APPEND ISPC_TARGETS avx512skx-i8x64 avx512skx-i16x32)
--    endif()
-+        avx512skx-i32x16 avx512skx-i32x8
-+        avx512skx-i8x64 avx512skx-i16x32)
- endif()
- if (ARM_ENABLED)
-     list(APPEND ISPC_TARGETS neon-i8x16 neon-i16x8 neon-i32x4 neon-i32x8)
-@@ -259,11 +257,7 @@ if (WASM_ENABLED)
- endif()
- 
- set(CLANG_LIBRARY_LIST clangFrontend clangDriver clangSerialization clangParse clangSema clangAnalysis clangAST clangBasic clangEdit clangLex)
--set(LLVM_COMPONENTS engine ipo bitreader bitwriter instrumentation linker option)
--
--if (${LLVM_VERSION_NUMBER} VERSION_GREATER_EQUAL "10.0.0")
--    list(APPEND LLVM_COMPONENTS frontendopenmp)
--endif()
-+set(LLVM_COMPONENTS engine ipo bitreader bitwriter instrumentation linker option frontendopenmp)
- 
- if (X86_ENABLED)
-     list(APPEND LLVM_COMPONENTS x86)
-diff --git a/src/ast.cpp b/src/ast.cpp
-index 20f75a29c..5a43c4854 100644
---- a/src/ast.cpp
-+++ b/src/ast.cpp
-@@ -44,9 +44,7 @@
- #include "sym.h"
- #include "util.h"
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
- #include <llvm/Support/TimeProfiler.h>
--#endif
- ///////////////////////////////////////////////////////////////////////////
- // ASTNode
- 
-@@ -62,9 +60,7 @@ void AST::AddFunction(Symbol *sym, Stmt *code) {
- }
- 
- void AST::GenerateIR() {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope TimeScope("GenerateIR");
--#endif
-     for (unsigned int i = 0; i < functions.size(); ++i)
-         functions[i]->GenerateIR();
- }
-diff --git a/src/ctx.cpp b/src/ctx.cpp
-index 977e9d222..42c4ea09d 100644
---- a/src/ctx.cpp
-+++ b/src/ctx.cpp
-@@ -309,21 +309,13 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym, llvm::F
-             char buf[256];
-             snprintf(buf, sizeof(buf), "__off_all_on_mask_%s", g->target->GetISAString());
- 
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_8_0
--            llvm::Constant *offFunc = m->module->getOrInsertFunction(buf, LLVMTypes::VoidType);
--#else // LLVM 9.0+
-             llvm::FunctionCallee offFuncCallee = m->module->getOrInsertFunction(buf, LLVMTypes::VoidType);
-             llvm::Constant *offFunc = llvm::cast<llvm::Constant>(offFuncCallee.getCallee());
--#endif
-             AssertPos(currentPos, llvm::isa<llvm::Function>(offFunc));
-             llvm::BasicBlock *offBB = llvm::BasicBlock::Create(*g->ctx, "entry", (llvm::Function *)offFunc, 0);
-             llvm::StoreInst *inst = new llvm::StoreInst(LLVMMaskAllOff, globalAllOnMaskPtr, offBB);
-             if (g->opt.forceAlignedMemory) {
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--                inst->setAlignment(g->target->getNativeVectorAlignment());
--#else // LLVM 10.0+
-                 inst->setAlignment(llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne());
--#endif
-             }
-             llvm::ReturnInst::Create(*g->ctx, offBB);
-         }
-@@ -2288,11 +2280,7 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, const Type *type, c
- #endif
- 
-     if (g->opt.forceAlignedMemory && llvm::dyn_cast<llvm::VectorType>(pt->getElementType())) {
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--        inst->setAlignment(g->target->getNativeVectorAlignment());
--#else // LLVM 10.0+
-         inst->setAlignment(llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne());
--#endif
-     }
- 
-     AddDebugPos(inst);
-@@ -2431,11 +2419,7 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
-                 // vs the proper alignment in practice.)
-                 int align = 1;
- 
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--                inst->setAlignment(align);
--#else // LLVM 10.0+
-                 inst->setAlignment(llvm::MaybeAlign(align).valueOrOne());
--#endif
-             }
- 
-             AddDebugPos(inst);
-@@ -2649,11 +2633,7 @@ llvm::Value *FunctionEmitContext::AllocaInst(llvm::Type *llvmType, const char *n
-         align = g->target->getNativeVectorAlignment();
- 
-     if (align != 0) {
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--        inst->setAlignment(align);
--#else // LLVM 10.0+
-         inst->setAlignment(llvm::MaybeAlign(align).valueOrOne());
--#endif
-     }
-     // Don't add debugging info to alloca instructions
-     return inst;
-@@ -2926,11 +2906,7 @@ void FunctionEmitContext::StoreInst(llvm::Value *value, llvm::Value *ptr, const
-     llvm::StoreInst *inst = new llvm::StoreInst(value, ptr, bblock);
- 
-     if (g->opt.forceAlignedMemory && llvm::dyn_cast<llvm::VectorType>(pt->getElementType())) {
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--        inst->setAlignment(g->target->getNativeVectorAlignment());
--#else // LLVM 10.0+
-         inst->setAlignment(llvm::MaybeAlign(g->target->getNativeVectorAlignment()).valueOrOne());
--#endif
-     }
- 
- #ifdef ISPC_GENX_ENABLED
-@@ -3025,16 +3001,10 @@ void FunctionEmitContext::MemcpyInst(llvm::Value *dest, llvm::Value *src, llvm::
-     }
-     if (align == NULL)
-         align = LLVMInt32(1);
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_8_0
--    llvm::Constant *mcFunc =
--        m->module->getOrInsertFunction("llvm.memcpy.p0i8.p0i8.i64", LLVMTypes::VoidType, LLVMTypes::VoidPointerType,
--                                       LLVMTypes::VoidPointerType, LLVMTypes::Int64Type, LLVMTypes::BoolType);
--#else // LLVM 9.0+
-     llvm::FunctionCallee mcFuncCallee =
-         m->module->getOrInsertFunction("llvm.memcpy.p0i8.p0i8.i64", LLVMTypes::VoidType, LLVMTypes::VoidPointerType,
-                                        LLVMTypes::VoidPointerType, LLVMTypes::Int64Type, LLVMTypes::BoolType);
-     llvm::Constant *mcFunc = llvm::cast<llvm::Constant>(mcFuncCallee.getCallee());
--#endif
-     AssertPos(currentPos, mcFunc != NULL);
-     AssertPos(currentPos, llvm::isa<llvm::Function>(mcFunc));
- 
-diff --git a/src/gen/GlobalsLocalization.cpp b/src/gen/GlobalsLocalization.cpp
-index 193a66289..a176e9462 100644
---- a/src/gen/GlobalsLocalization.cpp
-+++ b/src/gen/GlobalsLocalization.cpp
-@@ -470,11 +470,7 @@ void GlobalsLocalization::LocalizeGlobals(LocalizationInfo &LI) {
-         Instruction &FirstI = *Fn->getEntryBlock().begin();
-         Type *ElemTy = GV->getType()->getElementType();
-         AllocaInst *Alloca = new AllocaInst(ElemTy, 0, GV->getName() + ".local", &FirstI);
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--        Alloca->setAlignment(GV->getAlignment());
--#else // LLVM 10.0+
-         Alloca->setAlignment(llvm::MaybeAlign(GV->getAlignment()));
--#endif
-         if (!isa<UndefValue>(GV->getInitializer()))
-             new StoreInst(GV->getInitializer(), Alloca, &FirstI);
- 
-diff --git a/src/ispc.cpp b/src/ispc.cpp
-index e2d0f206e..fac5233f7 100644
---- a/src/ispc.cpp
-+++ b/src/ispc.cpp
-@@ -272,9 +272,7 @@ typedef enum {
-     CPU_Silvermont,
- 
-     CPU_ICX,
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     CPU_TGL,
--#endif
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_12_0
-     CPU_ADL,
-     CPU_SPR,
-@@ -365,10 +363,8 @@ class AllCPUs {
- 
-         names[CPU_ICX].push_back("icelake-server");
-         names[CPU_ICX].push_back("icx");
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         names[CPU_TGL].push_back("tigerlake");
-         names[CPU_TGL].push_back("tgl");
--#endif
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_12_0
-         names[CPU_ADL].push_back("alderlake");
-         names[CPU_ADL].push_back("adl");
-@@ -411,11 +407,9 @@ class AllCPUs {
-         compat[CPU_ADL] = Set(CPU_ADL, CPU_x86_64, CPU_Bonnell, CPU_Penryn, CPU_Core2, CPU_Nehalem, CPU_Silvermont,
-                               CPU_SandyBridge, CPU_IvyBridge, CPU_Haswell, CPU_Broadwell, CPU_None);
- #endif
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         compat[CPU_TGL] =
-             Set(CPU_TGL, CPU_x86_64, CPU_Bonnell, CPU_Penryn, CPU_Core2, CPU_Nehalem, CPU_Silvermont, CPU_SandyBridge,
-                 CPU_IvyBridge, CPU_Haswell, CPU_Broadwell, CPU_SKX, CPU_ICL, CPU_ICX, CPU_None);
--#endif
-         compat[CPU_ICX] = Set(CPU_ICX, CPU_x86_64, CPU_Bonnell, CPU_Penryn, CPU_Core2, CPU_Nehalem, CPU_Silvermont,
-                               CPU_SandyBridge, CPU_IvyBridge, CPU_Haswell, CPU_Broadwell, CPU_SKX, CPU_ICL, CPU_None);
- 
-@@ -556,9 +550,7 @@ Target::Target(Arch arch, const char *cpu, ISPCTarget ispc_target, bool pic, boo
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_12_0
-         case CPU_SPR:
- #endif
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         case CPU_TGL:
--#endif
-         case CPU_ICX:
-         case CPU_ICL:
-         case CPU_SKX:
-@@ -916,7 +908,6 @@ Target::Target(Arch arch, const char *cpu, ISPCTarget ispc_target, bool pic, boo
-         }
-         break;
-     case ISPCTarget::avx512skx_i8x64:
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0 // LLVM 10.0+
-         // This target is enabled only for LLVM 10.0 and later
-         // because LLVM requires a number of fixes, which are
-         // committed to LLVM 11.0 and can be applied to 10.0, but not
-@@ -937,12 +928,7 @@ Target::Target(Arch arch, const char *cpu, ISPCTarget ispc_target, bool pic, boo
-         this->m_hasVecPrefetch = false;
-         CPUfromISA = CPU_SKX;
-         break;
--#else
--        unsupported_target = true;
--        break;
--#endif
-     case ISPCTarget::avx512skx_i16x32:
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0 // LLVM 10.0+
-         // This target is enabled only for LLVM 10.0 and later
-         // because LLVM requires a number of fixes, which are
-         // committed to LLVM 11.0 and can be applied to 10.0, but not
-@@ -963,10 +949,6 @@ Target::Target(Arch arch, const char *cpu, ISPCTarget ispc_target, bool pic, boo
-         this->m_hasVecPrefetch = false;
-         CPUfromISA = CPU_SKX;
-         break;
--#else
--        unsupported_target = true;
--        break;
--#endif
- #ifdef ISPC_ARM_ENABLED
-     case ISPCTarget::neon_i8x16:
-         this->m_isa = Target::NEON;
-@@ -1662,11 +1644,9 @@ Globals::Globals() {
-     isMultiTargetCompilation = false;
-     errorLimit = -1;
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     enableTimeTrace = false;
-     // set default granularity to 500.
-     timeTraceGranularity = 500;
--#endif
-     target = NULL;
-     ctx = new llvm::LLVMContext;
- 
-diff --git a/src/ispc.h b/src/ispc.h
-index e25d8830e..de357a21c 100644
---- a/src/ispc.h
-+++ b/src/ispc.h
-@@ -695,13 +695,12 @@ struct Globals {
- 
-     /* Number of errors to show in ISPC. */
-     int errorLimit;
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-+
-     /* When true, enable compile time tracing. */
-     bool enableTimeTrace;
- 
-     /* When compile time tracing is enabled, set time granularity. */
-     int timeTraceGranularity;
--#endif
- };
- 
- enum {
-diff --git a/src/ispc_version.h b/src/ispc_version.h
-index d781347fd..434b2d678 100644
---- a/src/ispc_version.h
-+++ b/src/ispc_version.h
-@@ -44,13 +44,11 @@
- 
- #define ISPC_LLVM_VERSION (LLVM_VERSION_MAJOR * 10000 + LLVM_VERSION_MINOR * 100)
- 
--#define ISPC_LLVM_8_0 80000
--#define ISPC_LLVM_9_0 90000
- #define ISPC_LLVM_10_0 100000
- #define ISPC_LLVM_11_0 110000
- #define ISPC_LLVM_12_0 120000
- 
--#define OLDEST_SUPPORTED_LLVM ISPC_LLVM_8_0
-+#define OLDEST_SUPPORTED_LLVM ISPC_LLVM_10_0
- #define LATEST_SUPPORTED_LLVM ISPC_LLVM_12_0
- 
- #ifdef __ispc__xstr
-diff --git a/src/main.cpp b/src/main.cpp
-index 8f64330cc..5c920eabc 100644
---- a/src/main.cpp
-+++ b/src/main.cpp
-@@ -55,9 +55,7 @@
- #include <llvm/Support/Signals.h>
- #include <llvm/Support/TargetRegistry.h>
- #include <llvm/Support/TargetSelect.h>
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
- #include <llvm/Support/ToolOutputFile.h>
--#endif
- 
- #ifdef ISPC_HOST_IS_WINDOWS
- #define strcasecmp stricmp
-@@ -181,11 +179,9 @@ static void lPrintVersion() {
-     snprintf(targetHelp, sizeof(targetHelp), "[--target-os=<os>]\t\t\tSelect target OS.  <os>={%s}",
-              g->target_registry->getSupportedOSes().c_str());
-     PrintWithWordBreaks(targetHelp, 24, TerminalWidth(), stdout);
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     printf("    [--time-trace]\t\t\tTurn on time profiler. Generates JSON file based on output filename.\n");
-     printf("    [--time-trace-granularity=<value>\tMinimum time granularity (in microseconds) traced by time "
-            "profiler.\n");
--#endif
-     printf("    [--version]\t\t\t\tPrint ispc version\n");
- #ifdef ISPC_GENX_ENABLED
-     printf("    [--vc-options=<\"-option1 -option2...\">]\t\t\t\tPass additional options to Vector Compiler backend\n");
-@@ -462,7 +458,6 @@ static void setCallingConv(VectorCallStatus vectorCall, Arch arch) {
-     }
- }
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
- static void writeCompileTimeFile(const char *outFileName) {
-     llvm::SmallString<128> jsonFileName(outFileName);
-     jsonFileName.append(".json");
-@@ -479,7 +474,6 @@ static void writeCompileTimeFile(const char *outFileName) {
-     of->keep();
-     return;
- }
--#endif
- 
- static std::set<int> ParsingPhases(char *stages, ArgErrors &errorHandler) {
-     constexpr int parsing_limit = 100;
-@@ -791,12 +785,10 @@ int main(int Argc, char *Argv[]) {
-             }
-         } else if (!strncmp(argv[i], "--force-alignment=", 18)) {
-             g->forceAlignment = atoi(argv[i] + 18);
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         } else if (!strcmp(argv[i], "--time-trace")) {
-             g->enableTimeTrace = true;
-         } else if (!strncmp(argv[i], "--time-trace-granularity=", 25)) {
-             g->timeTraceGranularity = atoi(argv[i] + 25);
--#endif
-         } else if (!strcmp(argv[i], "--woff") || !strcmp(argv[i], "-woff")) {
-             g->disableWarnings = true;
-             g->emitPerfWarnings = false;
-@@ -1059,7 +1051,6 @@ int main(int Argc, char *Argv[]) {
- 
-     // This needs to happen after the TargetOS is decided.
-     setCallingConv(vectorCall, arch);
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     if (g->enableTimeTrace) {
-         llvm::timeTraceProfilerInitialize(g->timeTraceGranularity, "ispc");
-     }
-@@ -1077,9 +1068,5 @@ int main(int Argc, char *Argv[]) {
-         }
-         llvm::timeTraceProfilerCleanup();
-     }
--#else
--    int ret = Module::CompileAndOutput(file, arch, cpu, targets, flags, ot, outFileName, headerFileName, depsFileName,
--                                       depsTargetName, hostStubFileName, devStubFileName);
--#endif
-     return ret;
- }
-diff --git a/src/module.cpp b/src/module.cpp
-index fe7452df1..a85fec77a 100644
---- a/src/module.cpp
-+++ b/src/module.cpp
-@@ -170,9 +170,7 @@ Module::Module(const char *fn) {
-     module->setDataLayout(g->target->getDataLayout()->getStringRepresentation());
- 
-     if (g->generateDebuggingSymbols) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         llvm::TimeTraceScope TimeScope("Create Debug Data");
--#endif
-         // To enable debug information on Windows, we have to let llvm know, that
-         // debug information should be emitted in CodeView format.
-         if (g->target_os == TargetOS::windows) {
-@@ -226,10 +224,8 @@ extern YY_BUFFER_STATE yy_create_buffer(FILE *, int);
- extern void yy_delete_buffer(YY_BUFFER_STATE);
- 
- int Module::CompileFile() {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope CompileFileTimeScope(
-         "CompileFile", llvm::StringRef(filename + ("_" + std::string(g->target->GetISAString()))));
--#endif
-     extern void ParserInit();
-     ParserInit();
- 
-@@ -238,18 +234,14 @@ int Module::CompileFile() {
-     // variable 'm' to be initialized and available (which it isn't until
-     // the Module constructor returns...)
-     {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         llvm::TimeTraceScope TimeScope("DefineStdlib");
--#endif
-         DefineStdlib(symbolTable, g->ctx, module, g->includeStdlib);
-     }
- 
-     bool runPreprocessor = g->runCPP;
- 
-     if (runPreprocessor) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         llvm::TimeTraceScope TimeScope("Frontend parser");
--#endif
-         if (!IsStdin(filename)) {
-             // Try to open the file first, since otherwise we crash in the
-             // preprocessor if the file doesn't exist.
-@@ -268,9 +260,7 @@ int Module::CompileFile() {
-         yyparse();
-         yy_delete_buffer(strbuf);
-     } else {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-         llvm::TimeTraceScope TimeScope("Frontend parser");
--#endif
-         // No preprocessor, just open up the file if it's not stdin..
-         FILE *f = NULL;
-         if (IsStdin(filename)) {
-@@ -297,9 +287,7 @@ int Module::CompileFile() {
- 
-     if (diBuilder)
-         diBuilder->finalize();
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope TimeScope("Optimize");
--#endif
-     if (errorCount == 0)
-         Optimize(module, g->opt.level);
- 
-@@ -1243,15 +1231,8 @@ bool Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine, llvm:
-                                        const char *outFileName) {
-     // Figure out if we're generating object file or assembly output, and
-     // set binary output for object files
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--    Assert(!g->target->isGenXTarget());
--    llvm::TargetMachine::CodeGenFileType fileType =
--        (outputType == Object) ? llvm::TargetMachine::CGFT_ObjectFile : llvm::TargetMachine::CGFT_AssemblyFile;
--    bool binary = (fileType == llvm::TargetMachine::CGFT_ObjectFile);
--#else // LLVM 10.0+
-     llvm::CodeGenFileType fileType = (outputType == Object) ? llvm::CGFT_ObjectFile : llvm::CGFT_AssemblyFile;
-     bool binary = (fileType == llvm::CGFT_ObjectFile);
--#endif
- 
-     llvm::sys::fs::OpenFlags flags = binary ? llvm::sys::fs::F_None : llvm::sys::fs::F_Text;
- 
-@@ -2219,11 +2200,7 @@ void Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *
-     inst.setTarget(target);
-     inst.createSourceManager(inst.getFileManager());
- 
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--    clang::FrontendInputFile inputFile(infilename, clang::InputKind::Unknown);
--#else // LLVM 10.0+
-     clang::FrontendInputFile inputFile(infilename, clang::InputKind());
--#endif
- 
-     inst.InitializeSourceManager(inputFile);
- 
-@@ -2722,9 +2699,7 @@ int Module::CompileAndOutput(const char *srcFile, Arch arch, const char *cpu, st
- 
-         m = new Module(srcFile);
-         if (m->CompileFile() == 0) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-             llvm::TimeTraceScope TimeScope("Backend");
--#endif
- #ifdef ISPC_GENX_ENABLED
-             if (outputType == Asm || outputType == Object) {
-                 if (g->target->isGenXTarget()) {
-@@ -2855,9 +2830,7 @@ int Module::CompileAndOutput(const char *srcFile, Arch arch, const char *cpu, st
- 
-             m = new Module(srcFile);
-             int compileFileError = m->CompileFile();
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-             llvm::TimeTraceScope TimeScope("Backend");
--#endif
-             if (compileFileError == 0) {
-                 // Create the dispatch module, unless already created;
-                 // in the latter case, just do the checking
-diff --git a/src/module.h b/src/module.h
-index 61d3cfea0..603124d50 100644
---- a/src/module.h
-+++ b/src/module.h
-@@ -43,9 +43,7 @@
- 
- #include <llvm/IR/DebugInfo.h>
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
- #include <llvm/Support/TimeProfiler.h>
--#endif
- 
- #ifdef ISPC_GENX_ENABLED
- #include "ocl_igc_interface/igc_ocl_device_ctx.h"
-diff --git a/src/opt.cpp b/src/opt.cpp
-index a655a8344..5b1ac7b63 100644
---- a/src/opt.cpp
-+++ b/src/opt.cpp
-@@ -66,6 +66,7 @@
- #include <llvm/IR/Instructions.h>
- #include <llvm/IR/IntrinsicInst.h>
- #include <llvm/IR/Intrinsics.h>
-+#include <llvm/IR/IntrinsicsX86.h>
- #include <llvm/IR/LegacyPassManager.h>
- #include <llvm/IR/Module.h>
- #include <llvm/IR/PatternMatch.h>
-@@ -85,9 +86,6 @@
- #include <llvm/Transforms/Scalar/InstSimplifyPass.h>
- #include <llvm/Transforms/Utils.h>
- #include <llvm/Transforms/Utils/BasicBlockUtils.h>
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
--#include <llvm/IR/IntrinsicsX86.h>
--#endif
- 
- #ifdef ISPC_HOST_IS_LINUX
- #include <alloca.h>
-@@ -1003,10 +1001,7 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
-                 else
-                     align = callInst->getCalledFunction() == avxMaskedLoad32 ? 4 : 8;
-                 name = LLVMGetName(callInst->getArgOperand(0), "_load");
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--                llvm::Instruction *loadInst =
--                    new llvm::LoadInst(castPtr, name, false /* not volatile */, align, (llvm::Instruction *)NULL);
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-+#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-                 llvm::Instruction *loadInst = new llvm::LoadInst(castPtr, name, false /* not volatile */,
-                                                                  llvm::MaybeAlign(align), (llvm::Instruction *)NULL);
- #else
-@@ -1043,13 +1038,8 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
-                     align = g->target->getNativeVectorAlignment();
-                 else
-                     align = callInst->getCalledFunction() == avxMaskedStore32 ? 4 : 8;
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--                llvm::StoreInst *storeInst = new llvm::StoreInst(rvalue, castPtr, (llvm::Instruction *)NULL);
--                storeInst->setAlignment(align);
--#else
-                 llvm::StoreInst *storeInst = new llvm::StoreInst(rvalue, castPtr, (llvm::Instruction *)NULL,
-                                                                  llvm::MaybeAlign(align).valueOrOne());
--#endif
-                 lCopyMetadata(storeInst, callInst);
-                 llvm::ReplaceInstWithInst(callInst, storeInst);
- 
-@@ -1066,9 +1056,7 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool IntrinsicsOpt::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("IntrinsicsOpt::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -1239,9 +1227,7 @@ bool InstructionSimplifyPass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool InstructionSimplifyPass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("InstructionSimplifyPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -2974,16 +2960,10 @@ static bool lImproveMaskedStore(llvm::CallInst *callInst) {
- 
-             lvalue = new llvm::BitCastInst(lvalue, ptrType, "lvalue_to_ptr_type", callInst);
-             lCopyMetadata(lvalue, callInst);
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--            store =
--                new llvm::StoreInst(rvalue, lvalue, false /* not volatile */,
--                                    g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align);
--#else
-             store = new llvm::StoreInst(
-                 rvalue, lvalue, false /* not volatile */,
-                 llvm::MaybeAlign(g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align)
-                     .valueOrOne());
--#endif
-         }
-         if (store != NULL) {
-             lCopyMetadata(store, callInst);
-@@ -3059,11 +3039,7 @@ static bool lImproveMaskedLoad(llvm::CallInst *callInst, llvm::BasicBlock::itera
-         {
-             llvm::Type *ptrType = llvm::PointerType::get(callInst->getType(), 0);
-             ptr = new llvm::BitCastInst(ptr, ptrType, "ptr_cast_for_load", callInst);
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--            load = new llvm::LoadInst(ptr, callInst->getName(), false /* not volatile */,
--                                      g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align,
--                                      (llvm::Instruction *)NULL);
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-+#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-             load = new llvm::LoadInst(
-                 ptr, callInst->getName(), false /* not volatile */,
-                 llvm::MaybeAlign(g->opt.forceAlignedMemory ? g->target->getNativeVectorAlignment() : info->align)
-@@ -3129,9 +3105,7 @@ bool ImproveMemoryOpsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool ImproveMemoryOpsPass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("ImproveMemoryOpsPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -3424,9 +3398,7 @@ llvm::Value *lGEPAndLoad(llvm::Value *basePtr, int64_t offset, int align, llvm::
-                          llvm::Type *type) {
-     llvm::Value *ptr = lGEPInst(basePtr, LLVMInt64(offset), "new_base", insertBefore);
-     ptr = new llvm::BitCastInst(ptr, llvm::PointerType::get(type, 0), "ptr_cast", insertBefore);
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--    return new llvm::LoadInst(ptr, "gather_load", false /* not volatile */, align, insertBefore);
--#elif ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-+#if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
-     return new llvm::LoadInst(ptr, "gather_load", false /* not volatile */, llvm::MaybeAlign(align), insertBefore);
- #else // LLVM 11.0+
-     return new llvm::LoadInst(llvm::dyn_cast<llvm::PointerType>(ptr->getType())->getPointerElementType(), ptr,
-@@ -4135,9 +4107,7 @@ bool GatherCoalescePass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool GatherCoalescePass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("GatherCoalescePass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -4467,9 +4437,7 @@ bool ReplacePseudoMemoryOpsPass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool ReplacePseudoMemoryOpsPass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("ReplacePseudoMemoryOpsPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -4573,9 +4541,7 @@ bool IsCompileTimeConstantPass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool IsCompileTimeConstantPass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("IsCompileTimeConstantPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -5201,9 +5167,7 @@ bool PeepholePass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool PeepholePass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("PeepholePass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -5299,9 +5263,7 @@ bool ReplaceStdlibShiftPass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool ReplaceStdlibShiftPass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("ReplaceStdlibShiftPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -5399,9 +5361,7 @@ llvm::Instruction *FixBooleanSelectPass::fixSelect(llvm::SelectInst *sel, llvm::
- }
- 
- bool FixBooleanSelectPass::runOnFunction(llvm::Function &F) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("FixBooleanSelectPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
- 
-     return modifiedAny;
-@@ -5964,9 +5924,7 @@ bool GenXGatherCoalescing::runOnBasicBlock(llvm::BasicBlock &bb) {
- }
- 
- bool GenXGatherCoalescing::runOnFunction(llvm::Function &F) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("GenXGatherCoalescing::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -6113,9 +6071,7 @@ bool PromoteToPrivateMemoryPass::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool PromoteToPrivateMemoryPass::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("PromoteToPrivateMemoryPass::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -6181,9 +6137,7 @@ bool ReplaceLLVMIntrinsics::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool ReplaceLLVMIntrinsics::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("ReplaceLLVMIntrinsics::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -6278,9 +6232,7 @@ bool ReplaceUnsupportedInsts::runOnBasicBlock(llvm::BasicBlock &bb) {
- 
- bool ReplaceUnsupportedInsts::runOnFunction(llvm::Function &F) {
- 
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("ReplaceUnsupportedInsts::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -6369,9 +6321,7 @@ bool CheckUnsupportedInsts::runOnBasicBlock(llvm::BasicBlock &bb) {
- }
- 
- bool CheckUnsupportedInsts::runOnFunction(llvm::Function &F) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("CheckUnsupportedInsts::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -6440,9 +6390,7 @@ bool MangleOpenCLBuiltins::runOnBasicBlock(llvm::BasicBlock &bb) {
- }
- 
- bool MangleOpenCLBuiltins::runOnFunction(llvm::Function &F) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("MangleOpenCLBuiltins::runOnFunction", F.getName());
--#endif
-     bool modifiedAny = false;
-     for (llvm::BasicBlock &BB : F) {
-         modifiedAny |= runOnBasicBlock(BB);
-@@ -6828,9 +6776,7 @@ bool FixAddressSpace::runOnFunction(llvm::Function &F) {
-     // Transformations are correct when the function is not internal.
-     // This is due to address space calculation algorithm.
-     // TODO: problems can be met in case of Stack Calls
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("FixAddressSpace::runOnFunction", F.getName());
--#endif
-     if (F.getLinkage() == llvm::GlobalValue::LinkageTypes::InternalLinkage)
-         return false;
- 
-@@ -6854,9 +6800,7 @@ class DemotePHIs : public llvm::FunctionPass {
- char DemotePHIs::ID = 0;
- 
- bool DemotePHIs::runOnFunction(llvm::Function &F) {
--#if ISPC_LLVM_VERSION >= ISPC_LLVM_10_0
-     llvm::TimeTraceScope FuncScope("DemotePHIs::runOnFunction", F.getName());
--#endif
-     if (F.isDeclaration() || skipFunction(F))
-         return false;
-     std::vector<llvm::Instruction *> WorkList;
-diff --git a/src/type.cpp b/src/type.cpp
-index 688a4e874..fa0cb04db 100644
---- a/src/type.cpp
-+++ b/src/type.cpp
-@@ -1822,14 +1822,10 @@ llvm::DIType *StructType::GetDIType(llvm::DIScope *scope) const {
-     llvm::DIFile *diFile = pos.GetDIFile();
-     llvm::DINamespace *diSpace = pos.GetDINamespace();
-     return m->diBuilder->createStructType(diSpace, GetString(), diFile,
--                                          pos.first_line,          // Line number
--                                          layout->getSizeInBits(), // Size in bits
--#if ISPC_LLVM_VERSION <= ISPC_LLVM_9_0
--                                          layout->getAlignment() * 8, // Alignment in bits
--#else                                                                 // LLVM 10.0+
-+                                          pos.first_line,                     // Line number
-+                                          layout->getSizeInBits(),            // Size in bits
-                                           layout->getAlignment().value() * 8, // Alignment in bits
--#endif
--                                          llvm::DINode::FlagZero, // Flags
-+                                          llvm::DINode::FlagZero,             // Flags
-                                           NULL, elements);
- }
- 
-diff --git a/tests/lit-tests/1771.ispc b/tests/lit-tests/1771.ispc
-index 98064d84d..4feb73dd7 100644
---- a/tests/lit-tests/1771.ispc
-+++ b/tests/lit-tests/1771.ispc
-@@ -5,7 +5,6 @@
- // RUN: %{ispc} %s --target=sse4-i16x8 --emit-asm -o - | FileCheck %s -check-prefix=CHECKSSE4_I16X8
- // RUN: %{ispc} %s --target=sse4-i8x16 --emit-asm -o - | FileCheck %s -check-prefix=CHECKSSE4_I8X16
- 
--// REQUIRES: LLVM_10_0+
- // REQUIRES: X86_ENABLED
- 
- // CHECKAVX2_I32X8: {{[a-z]*xor[a-z]*}}  %xmm0, %xmm0, %xmm0
-diff --git a/tests/lit-tests/1844.ispc b/tests/lit-tests/1844.ispc
-index 793a8866c..189edf4c3 100644
---- a/tests/lit-tests/1844.ispc
-+++ b/tests/lit-tests/1844.ispc
-@@ -6,9 +6,6 @@
- 
- // REQUIRES: X86_ENABLED
- 
--// It doesn't work for anything earlier than 10.0, but it will not be fixed, so don't run.
--// REQUIRES: LLVM_10_0+
--
- extern uniform unsigned int64 var_6;
- extern uniform unsigned int16 var_11;
- extern uniform bool arr_201 [1] [15] [20];
-diff --git a/tests/lit-tests/1926.ispc b/tests/lit-tests/1926.ispc
-index 70f7cc3c2..7921c91a6 100644
---- a/tests/lit-tests/1926.ispc
-+++ b/tests/lit-tests/1926.ispc
-@@ -2,8 +2,6 @@
- // RUN: cat %T/1926.o.json \
- // RUN:   | FileCheck %s
- 
--// REQUIRES: LLVM_10_0+
--
- // CHECK: "traceEvents"
- // CHECK: "detail"
- export uniform int foo(uniform int a[], uniform int count) {
-diff --git a/tests/lit-tests/cpus_x86.ispc b/tests/lit-tests/cpus_x86.ispc
-index 516efdd4c..4d60186f6 100644
---- a/tests/lit-tests/cpus_x86.ispc
-+++ b/tests/lit-tests/cpus_x86.ispc
-@@ -24,6 +24,8 @@
- //; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=icl
- //; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=icelake-server
- //; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=icx
-+//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=tigerlake
-+//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=tgl
- 
- // REQUIRES: X86_ENABLED
- 
-diff --git a/tests/lit-tests/cpus_x86_llvm10.ispc b/tests/lit-tests/cpus_x86_llvm10.ispc
-deleted file mode 100644
-index ef00000e5..000000000
---- a/tests/lit-tests/cpus_x86_llvm10.ispc
-+++ /dev/null
-@@ -1,11 +0,0 @@
--// The test checks that cpu definitions (including all synonyms) are successfully consumed by compiler.
--
--//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=tigerlake
--//; RUN: %{ispc} %s -o %t.o --nostdlib --target=sse2-i32x4 --cpu=tgl
--
--// REQUIRES: X86_ENABLED
--// REQUIRES: LLVM_10_0+
--
--uniform int i;
--
--void foo() {}
-diff --git a/tests/lit-tests/lit.cfg b/tests/lit-tests/lit.cfg
-index 17016579d..045e69437 100644
---- a/tests/lit-tests/lit.cfg
-+++ b/tests/lit-tests/lit.cfg
-@@ -30,11 +30,6 @@ print("Config:")
- 
- # LLVM version
- llvm_version = LooseVersion(ispc_llvm_version_number)
--if llvm_version >= LooseVersion("10.0.0"):
--    print("LLVM_10_0+: YES")
--    config.available_features.add("LLVM_10_0+")
--else:
--    print("LLVM_10_0+: NO")
- 
- if llvm_version >= LooseVersion("12.0.0"):
-     print("LLVM_12_0+: YES")
diff --git a/srcpkgs/ispc/patches/llvm12-003.patch b/srcpkgs/ispc/patches/llvm12-003.patch
deleted file mode 100644
index 0423afc9e3f9..000000000000
--- a/srcpkgs/ispc/patches/llvm12-003.patch
+++ /dev/null
@@ -1,1504 +0,0 @@
-From 1851d18b213dbad169937076176b2d5509733c76 Mon Sep 17 00:00:00 2001
-From: Deepak Rajendrakumaran <deepak.rajendrakumaran@intel.com>
-Date: Tue, 12 Jan 2021 22:15:12 -0800
-Subject: [PATCH] fixes #1821 - Removing LLVMGetName() and switching to
- LLVM::Twine.
-
----
- src/ctx.cpp      | 304 ++++++++++++++++++++++-------------------------
- src/ctx.h        |  72 +++++------
- src/expr.cpp     |  36 +++---
- src/llvmutil.cpp |  17 ---
- src/llvmutil.h   |   5 -
- src/opt.cpp      | 103 +++++++++-------
- 6 files changed, 255 insertions(+), 282 deletions(-)
-
-diff --git a/src/ctx.cpp b/src/ctx.cpp
-index 42c4ea09d..ded524b71 100644
---- a/src/ctx.cpp
-+++ b/src/ctx.cpp
-@@ -1020,8 +1020,8 @@ void FunctionEmitContext::EmitCaseLabel(int value, bool checkMask, SourcePos pos
-     llvm::BasicBlock *bbCaseImpl = NULL;
-     if (emitGenXHardwareMask()) {
-         // Create basic block with actual case implementation
--        std::string bbName = bbCase->getName().str() + "_impl";
--        bbCaseImpl = CreateBasicBlock(bbName.c_str(), bbCase);
-+        llvm::Twine bbName = llvm::Twine(bbCase->getName()) + "_impl";
-+        bbCaseImpl = CreateBasicBlock(bbName, bbCase);
-     }
- #endif
- 
-@@ -1185,7 +1185,7 @@ bool FunctionEmitContext::initLabelBBlocks(ASTNode *node, void *data) {
-     if (ctx->labelMap.find(ls->name) != ctx->labelMap.end())
-         Error(ls->pos, "Multiple labels named \"%s\" in function.", ls->name.c_str());
-     else {
--        llvm::BasicBlock *bb = ctx->CreateBasicBlock(ls->name.c_str());
-+        llvm::BasicBlock *bb = ctx->CreateBasicBlock(ls->name);
-         ctx->labelMap[ls->name] = bb;
-     }
-     return true;
-@@ -1299,7 +1299,7 @@ llvm::Value *FunctionEmitContext::Any(llvm::Value *mask) {
-     // We can actually call either one, since both are i32s as far as
-     // LLVM's type system is concerned...
-     llvm::Function *fmm = mm[0]->function;
--    return CallInst(fmm, NULL, mask, LLVMGetName(mask, "_any"));
-+    return CallInst(fmm, NULL, mask, llvm::Twine(mask->getName()) + "_any");
- }
- 
- llvm::Value *FunctionEmitContext::All(llvm::Value *mask) {
-@@ -1315,7 +1315,7 @@ llvm::Value *FunctionEmitContext::All(llvm::Value *mask) {
-     // We can actually call either one, since both are i32s as far as
-     // LLVM's type system is concerned...
-     llvm::Function *fmm = mm[0]->function;
--    return CallInst(fmm, NULL, mask, LLVMGetName(mask, "_all"));
-+    return CallInst(fmm, NULL, mask, llvm::Twine(mask->getName()) + "_all");
- }
- 
- llvm::Value *FunctionEmitContext::None(llvm::Value *mask) {
-@@ -1331,7 +1331,7 @@ llvm::Value *FunctionEmitContext::None(llvm::Value *mask) {
-     // We can actually call either one, since both are i32s as far as
-     // LLVM's type system is concerned...
-     llvm::Function *fmm = mm[0]->function;
--    return CallInst(fmm, NULL, mask, LLVMGetName(mask, "_none"));
-+    return CallInst(fmm, NULL, mask, llvm::Twine(mask->getName()) + "_none");
- }
- 
- llvm::Value *FunctionEmitContext::LaneMask(llvm::Value *v) {
-@@ -1349,7 +1349,7 @@ llvm::Value *FunctionEmitContext::LaneMask(llvm::Value *v) {
-     // We can actually call either one, since both are i32s as far as
-     // LLVM's type system is concerned...
-     llvm::Function *fmm = mm[0]->function;
--    return CallInst(fmm, NULL, v, LLVMGetName(v, "_movmsk"));
-+    return CallInst(fmm, NULL, v, llvm::Twine(v->getName()) + "_movmsk");
- }
- 
- llvm::Value *FunctionEmitContext::MasksAllEqual(llvm::Value *v1, llvm::Value *v2) {
-@@ -1364,11 +1364,12 @@ llvm::Value *FunctionEmitContext::MasksAllEqual(llvm::Value *v1, llvm::Value *v2
- #else
-     if (g->target->getArch() == Arch::wasm32) {
-         llvm::Function *fmm = m->module->getFunction("__wasm_cmp_msk_eq");
--        return CallInst(fmm, NULL, {v1, v2}, LLVMGetName("wasm_cmp_msk_eq", v1, v2));
-+        return CallInst(fmm, NULL, {v1, v2}, ((llvm::Twine("wasm_cmp_msk_eq_") + v1->getName()) + "_") + v2->getName());
-     }
-     llvm::Value *mm1 = LaneMask(v1);
-     llvm::Value *mm2 = LaneMask(v2);
--    return CmpInst(llvm::Instruction::ICmp, llvm::CmpInst::ICMP_EQ, mm1, mm2, LLVMGetName("equal", v1, v2));
-+    return CmpInst(llvm::Instruction::ICmp, llvm::CmpInst::ICMP_EQ, mm1, mm2,
-+                   ((llvm::Twine("equal_") + v1->getName()) + "_") + v2->getName());
- #endif
- }
- 
-@@ -1392,7 +1393,7 @@ llvm::Value *FunctionEmitContext::GetStringPtr(const std::string &str) {
-     return new llvm::BitCastInst(lstrPtr, LLVMTypes::VoidPointerType, "str_void_ptr", bblock);
- }
- 
--llvm::BasicBlock *FunctionEmitContext::CreateBasicBlock(const char *name, llvm::BasicBlock *insertAfter) {
-+llvm::BasicBlock *FunctionEmitContext::CreateBasicBlock(const llvm::Twine &name, llvm::BasicBlock *insertAfter) {
-     llvm::BasicBlock *newBB = llvm::BasicBlock::Create(*g->ctx, name, llvmFunction);
-     if (insertAfter)
-         newBB->moveAfter(insertAfter);
-@@ -1416,14 +1417,15 @@ llvm::Value *FunctionEmitContext::I1VecToBoolVec(llvm::Value *b) {
- 
-         for (unsigned int i = 0; i < at->getNumElements(); ++i) {
-             llvm::Value *elt = ExtractInst(b, i);
--            llvm::Value *sext = SwitchBoolSize(elt, LLVMTypes::BoolVectorStorageType, LLVMGetName(elt, "_to_boolvec"));
-+            llvm::Value *sext =
-+                SwitchBoolSize(elt, LLVMTypes::BoolVectorStorageType, llvm::Twine(elt->getName()) + "_to_boolvec");
-             ret = InsertInst(ret, sext, i);
-         }
-         return ret;
-     } else {
-         // For non-array types, convert to 'LLVMTypes::BoolVectorType' if
-         // necessary.
--        return SwitchBoolSize(b, LLVMTypes::BoolVectorType, LLVMGetName(b, "_to_boolvec"));
-+        return SwitchBoolSize(b, LLVMTypes::BoolVectorType, llvm::Twine(b->getName()) + "_to_boolvec");
-     }
- }
- 
-@@ -1563,7 +1565,7 @@ static int lArrayVectorWidth(llvm::Type *t) {
- }
- 
- llvm::Value *FunctionEmitContext::BinaryOperator(llvm::Instruction::BinaryOps inst, llvm::Value *v0, llvm::Value *v1,
--                                                 const char *name) {
-+                                                 const llvm::Twine &name) {
-     if (v0 == NULL || v1 == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -1573,7 +1575,7 @@ llvm::Value *FunctionEmitContext::BinaryOperator(llvm::Instruction::BinaryOps in
-     llvm::Type *type = v0->getType();
-     int arraySize = lArrayVectorWidth(type);
-     if (arraySize == 0) {
--        llvm::Instruction *bop = llvm::BinaryOperator::Create(inst, v0, v1, name ? name : "", bblock);
-+        llvm::Instruction *bop = llvm::BinaryOperator::Create(inst, v0, v1, name, bblock);
-         AddDebugPos(bop);
-         return bop;
-     } else {
-@@ -1591,7 +1593,7 @@ llvm::Value *FunctionEmitContext::BinaryOperator(llvm::Instruction::BinaryOps in
-     }
- }
- 
--llvm::Value *FunctionEmitContext::NotOperator(llvm::Value *v, const char *name) {
-+llvm::Value *FunctionEmitContext::NotOperator(llvm::Value *v, const llvm::Twine &name) {
-     if (v == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -1603,14 +1605,14 @@ llvm::Value *FunctionEmitContext::NotOperator(llvm::Value *v, const char *name)
-     llvm::Type *type = v->getType();
-     int arraySize = lArrayVectorWidth(type);
-     if (arraySize == 0) {
--        llvm::Instruction *binst = llvm::BinaryOperator::CreateNot(v, name ? name : "not", bblock);
-+        llvm::Instruction *binst = llvm::BinaryOperator::CreateNot(v, name.isTriviallyEmpty() ? "not" : name, bblock);
-         AddDebugPos(binst);
-         return binst;
-     } else {
-         llvm::Value *ret = llvm::UndefValue::get(type);
-         for (int i = 0; i < arraySize; ++i) {
-             llvm::Value *a = ExtractInst(v, i);
--            llvm::Value *op = llvm::BinaryOperator::CreateNot(a, name ? name : "not", bblock);
-+            llvm::Value *op = llvm::BinaryOperator::CreateNot(a, name.isTriviallyEmpty() ? "not" : name, bblock);
-             AddDebugPos(op);
-             ret = InsertInst(ret, op, i);
-         }
-@@ -1638,7 +1640,7 @@ static llvm::Type *lGetMatchingBoolVectorType(llvm::Type *type) {
- }
- 
- llvm::Value *FunctionEmitContext::CmpInst(llvm::Instruction::OtherOps inst, llvm::CmpInst::Predicate pred,
--                                          llvm::Value *v0, llvm::Value *v1, const char *name) {
-+                                          llvm::Value *v0, llvm::Value *v1, const llvm::Twine &name) {
-     if (v0 == NULL || v1 == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -1648,7 +1650,8 @@ llvm::Value *FunctionEmitContext::CmpInst(llvm::Instruction::OtherOps inst, llvm
-     llvm::Type *type = v0->getType();
-     int arraySize = lArrayVectorWidth(type);
-     if (arraySize == 0) {
--        llvm::Instruction *ci = llvm::CmpInst::Create(inst, pred, v0, v1, name ? name : "cmp", bblock);
-+        llvm::Instruction *ci =
-+            llvm::CmpInst::Create(inst, pred, v0, v1, name.isTriviallyEmpty() ? "cmp" : name, bblock);
-         AddDebugPos(ci);
-         return ci;
-     } else {
-@@ -1657,14 +1660,14 @@ llvm::Value *FunctionEmitContext::CmpInst(llvm::Instruction::OtherOps inst, llvm
-         for (int i = 0; i < arraySize; ++i) {
-             llvm::Value *a = ExtractInst(v0, i);
-             llvm::Value *b = ExtractInst(v1, i);
--            llvm::Value *op = CmpInst(inst, pred, a, b, name);
-+            llvm::Value *op = CmpInst(inst, pred, a, b, name.isTriviallyEmpty() ? "cmp" : name);
-             ret = InsertInst(ret, op, i);
-         }
-         return ret;
-     }
- }
- 
--llvm::Value *FunctionEmitContext::SmearUniform(llvm::Value *value, const char *name) {
-+llvm::Value *FunctionEmitContext::SmearUniform(llvm::Value *value, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -1704,21 +1707,19 @@ llvm::Value *FunctionEmitContext::SmearUniform(llvm::Value *value, const char *n
-     return ret;
- }
- 
--llvm::Value *FunctionEmitContext::BitCastInst(llvm::Value *value, llvm::Type *type, const char *name) {
-+llvm::Value *FunctionEmitContext::BitCastInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_bitcast");
--
--    llvm::Instruction *inst = new llvm::BitCastInst(value, type, name, bblock);
-+    llvm::Instruction *inst = new llvm::BitCastInst(
-+        value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_bitcast" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Value *FunctionEmitContext::PtrToIntInst(llvm::Value *value, const char *name) {
-+llvm::Value *FunctionEmitContext::PtrToIntInst(llvm::Value *value, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -1728,23 +1729,19 @@ llvm::Value *FunctionEmitContext::PtrToIntInst(llvm::Value *value, const char *n
-         // no-op for varying pointers; they're already vectors of ints
-         return value;
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_ptr2int");
-     llvm::Type *type = LLVMTypes::PointerIntType;
--    llvm::Instruction *inst = new llvm::PtrToIntInst(value, type, name, bblock);
-+    llvm::Instruction *inst = new llvm::PtrToIntInst(
-+        value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_ptr2int" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Value *FunctionEmitContext::PtrToIntInst(llvm::Value *value, llvm::Type *toType, const char *name) {
-+llvm::Value *FunctionEmitContext::PtrToIntInst(llvm::Value *value, llvm::Type *toType, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_ptr2int");
--
-     llvm::Type *fromType = value->getType();
-     if (llvm::isa<llvm::VectorType>(fromType)) {
-         // varying pointer
-@@ -1752,27 +1749,26 @@ llvm::Value *FunctionEmitContext::PtrToIntInst(llvm::Value *value, llvm::Type *t
-             // already the right type--done
-             return value;
-         else if (fromType->getScalarSizeInBits() > toType->getScalarSizeInBits())
--            return TruncInst(value, toType, name);
-+            return TruncInst(value, toType,
-+                             name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_ptr2int" : name);
-         else {
-             AssertPos(currentPos, fromType->getScalarSizeInBits() < toType->getScalarSizeInBits());
--            return ZExtInst(value, toType, name);
-+            return ZExtInst(value, toType, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_ptr2int" : name);
-         }
-     }
- 
--    llvm::Instruction *inst = new llvm::PtrToIntInst(value, toType, name, bblock);
-+    llvm::Instruction *inst = new llvm::PtrToIntInst(
-+        value, toType, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_ptr2int" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Value *FunctionEmitContext::IntToPtrInst(llvm::Value *value, llvm::Type *toType, const char *name) {
-+llvm::Value *FunctionEmitContext::IntToPtrInst(llvm::Value *value, llvm::Type *toType, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_int2ptr");
--
-     llvm::Type *fromType = value->getType();
-     if (llvm::isa<llvm::VectorType>(fromType)) {
-         // varying pointer
-@@ -1780,95 +1776,87 @@ llvm::Value *FunctionEmitContext::IntToPtrInst(llvm::Value *value, llvm::Type *t
-             // done
-             return value;
-         else if (fromType->getScalarSizeInBits() > toType->getScalarSizeInBits())
--            return TruncInst(value, toType, name);
-+            return TruncInst(value, toType,
-+                             name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_int2ptr" : name);
-         else {
-             AssertPos(currentPos, fromType->getScalarSizeInBits() < toType->getScalarSizeInBits());
--            return ZExtInst(value, toType, name);
-+            return ZExtInst(value, toType, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_int2ptr" : name);
-         }
-     }
- 
--    llvm::Instruction *inst = new llvm::IntToPtrInst(value, toType, name, bblock);
-+    llvm::Instruction *inst = new llvm::IntToPtrInst(
-+        value, toType, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_int2ptr" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Instruction *FunctionEmitContext::TruncInst(llvm::Value *value, llvm::Type *type, const char *name) {
-+llvm::Instruction *FunctionEmitContext::TruncInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_trunc");
--
-     // TODO: we should probably handle the array case as in
-     // e.g. BitCastInst(), but we don't currently need that functionality
--    llvm::Instruction *inst = new llvm::TruncInst(value, type, name, bblock);
-+    llvm::Instruction *inst = new llvm::TruncInst(
-+        value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_trunc" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
- llvm::Instruction *FunctionEmitContext::CastInst(llvm::Instruction::CastOps op, llvm::Value *value, llvm::Type *type,
--                                                 const char *name) {
-+                                                 const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_cast");
--
-     // TODO: we should probably handle the array case as in
-     // e.g. BitCastInst(), but we don't currently need that functionality
--    llvm::Instruction *inst = llvm::CastInst::Create(op, value, type, name, bblock);
-+    llvm::Instruction *inst = llvm::CastInst::Create(
-+        op, value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_cast" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Instruction *FunctionEmitContext::FPCastInst(llvm::Value *value, llvm::Type *type, const char *name) {
-+llvm::Instruction *FunctionEmitContext::FPCastInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_cast");
--
-     // TODO: we should probably handle the array case as in
-     // e.g. BitCastInst(), but we don't currently need that functionality
--    llvm::Instruction *inst = llvm::CastInst::CreateFPCast(value, type, name, bblock);
-+    llvm::Instruction *inst = llvm::CastInst::CreateFPCast(
-+        value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_cast" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Instruction *FunctionEmitContext::SExtInst(llvm::Value *value, llvm::Type *type, const char *name) {
-+llvm::Instruction *FunctionEmitContext::SExtInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_sext");
--
-     // TODO: we should probably handle the array case as in
-     // e.g. BitCastInst(), but we don't currently need that functionality
--    llvm::Instruction *inst = new llvm::SExtInst(value, type, name, bblock);
-+    llvm::Instruction *inst = new llvm::SExtInst(
-+        value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_sext" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
- 
--llvm::Instruction *FunctionEmitContext::ZExtInst(llvm::Value *value, llvm::Type *type, const char *name) {
-+llvm::Instruction *FunctionEmitContext::ZExtInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name) {
-     if (value == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(value, "_zext");
--
-     // TODO: we should probably handle the array case as in
-     // e.g. BitCastInst(), but we don't currently need that functionality
--    llvm::Instruction *inst = new llvm::ZExtInst(value, type, name, bblock);
-+    llvm::Instruction *inst = new llvm::ZExtInst(
-+        value, type, name.isTriviallyEmpty() ? llvm::Twine(value->getName()) + "_zext" : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
-@@ -1913,14 +1901,15 @@ llvm::Value *FunctionEmitContext::applyVaryingGEP(llvm::Value *basePtr, llvm::Va
-         scale = SmearUniform(scale);
-         Assert(index != NULL);
-         // offset = index * scale
--        offset = BinaryOperator(llvm::Instruction::Mul, scale, index, LLVMGetName("mul", scale, index));
-+        offset = BinaryOperator(llvm::Instruction::Mul, scale, index,
-+                                ((llvm::Twine("mul_") + scale->getName()) + "_") + index->getName());
-     }
- 
-     // For 64-bit targets, if we've been doing our offset calculations in
-     // 32 bits, we still have to convert to a 64-bit value before we
-     // actually add the offset to the pointer.
-     if (g->target->is32Bit() == false && g->opt.force32BitAddressing == true)
--        offset = SExtInst(offset, LLVMTypes::Int64VectorType, LLVMGetName(offset, "_to_64"));
-+        offset = SExtInst(offset, LLVMTypes::Int64VectorType, llvm::Twine(offset->getName()) + "_to_64");
- 
-     // Smear out the pointer to be varying; either the base pointer or the
-     // index must be varying for this method to be called.
-@@ -1929,7 +1918,7 @@ llvm::Value *FunctionEmitContext::applyVaryingGEP(llvm::Value *basePtr, llvm::Va
-     llvm::Value *varyingPtr = baseIsUniform ? SmearUniform(basePtr) : basePtr;
- 
-     // newPtr = ptr + offset
--    return BinaryOperator(llvm::Instruction::Add, varyingPtr, offset, LLVMGetName(basePtr, "_offset"));
-+    return BinaryOperator(llvm::Instruction::Add, varyingPtr, offset, llvm::Twine(basePtr->getName()) + "_offset");
- }
- 
- void FunctionEmitContext::MatchIntegerTypes(llvm::Value **v0, llvm::Value **v1) {
-@@ -2006,13 +1995,13 @@ llvm::Value *FunctionEmitContext::MakeSlicePointer(llvm::Value *ptr, llvm::Value
-     llvm::StructType *st = llvm::StructType::get(*g->ctx, eltTypes);
- 
-     llvm::Value *ret = llvm::UndefValue::get(st);
--    ret = InsertInst(ret, ptr, 0, LLVMGetName(ret, "_slice_ptr"));
--    ret = InsertInst(ret, offset, 1, LLVMGetName(ret, "_slice_offset"));
-+    ret = InsertInst(ret, ptr, 0, llvm::Twine(ret->getName()) + "_slice_ptr");
-+    ret = InsertInst(ret, offset, 1, llvm::Twine(ret->getName()) + "_slice_offset");
-     return ret;
- }
- 
- llvm::Value *FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::Value *index, const Type *ptrRefType,
--                                                    const char *name) {
-+                                                    const llvm::Twine &name) {
-     if (basePtr == NULL || index == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -2065,8 +2054,8 @@ llvm::Value *FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::
-         // uniform, so just emit the regular LLVM GEP instruction
-         llvm::Value *ind[1] = {index};
-         llvm::ArrayRef<llvm::Value *> arrayRef(&ind[0], &ind[1]);
--        llvm::Instruction *inst =
--            llvm::GetElementPtrInst::Create(PTYPE(basePtr), basePtr, arrayRef, name ? name : "gep", bblock);
-+        llvm::Instruction *inst = llvm::GetElementPtrInst::Create(PTYPE(basePtr), basePtr, arrayRef,
-+                                                                  name.isTriviallyEmpty() ? "gep" : name, bblock);
-         AddDebugPos(inst);
-         return inst;
-     } else
-@@ -2074,7 +2063,7 @@ llvm::Value *FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::
- }
- 
- llvm::Value *FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::Value *index0, llvm::Value *index1,
--                                                    const Type *ptrRefType, const char *name) {
-+                                                    const Type *ptrRefType, const llvm::Twine &name) {
-     if (basePtr == NULL || index0 == NULL || index1 == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -2114,8 +2103,8 @@ llvm::Value *FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::
-         // uniform, so just emit the regular LLVM GEP instruction
-         llvm::Value *indices[2] = {index0, index1};
-         llvm::ArrayRef<llvm::Value *> arrayRef(&indices[0], &indices[2]);
--        llvm::Instruction *inst =
--            llvm::GetElementPtrInst::Create(PTYPE(basePtr), basePtr, arrayRef, name ? name : "gep", bblock);
-+        llvm::Instruction *inst = llvm::GetElementPtrInst::Create(PTYPE(basePtr), basePtr, arrayRef,
-+                                                                  name.isTriviallyEmpty() ? "gep" : name, bblock);
-         AddDebugPos(inst);
-         return inst;
-     } else {
-@@ -2138,7 +2127,7 @@ llvm::Value *FunctionEmitContext::GetElementPtrInst(llvm::Value *basePtr, llvm::
- }
- 
- llvm::Value *FunctionEmitContext::AddElementOffset(llvm::Value *fullBasePtr, int elementNum, const Type *ptrRefType,
--                                                   const char *name, const PointerType **resultPtrType) {
-+                                                   const llvm::Twine &name, const PointerType **resultPtrType) {
-     if (resultPtrType != NULL)
-         AssertPos(currentPos, ptrRefType != NULL);
- 
-@@ -2195,8 +2184,8 @@ llvm::Value *FunctionEmitContext::AddElementOffset(llvm::Value *fullBasePtr, int
-         // If the pointer is uniform, we can use the regular LLVM GEP.
-         llvm::Value *offsets[2] = {LLVMInt32(0), LLVMInt32(elementNum)};
-         llvm::ArrayRef<llvm::Value *> arrayRef(&offsets[0], &offsets[2]);
--        resultPtr =
--            llvm::GetElementPtrInst::Create(PTYPE(basePtr), basePtr, arrayRef, name ? name : "struct_offset", bblock);
-+        resultPtr = llvm::GetElementPtrInst::Create(PTYPE(basePtr), basePtr, arrayRef,
-+                                                    name.isTriviallyEmpty() ? "struct_offset" : name, bblock);
-     } else {
-         // Otherwise do the math to find the offset and add it to the given
-         // varying pointers
-@@ -2237,7 +2226,7 @@ llvm::Value *FunctionEmitContext::AddElementOffset(llvm::Value *fullBasePtr, int
-         return resultPtr;
- }
- 
--llvm::Value *FunctionEmitContext::SwitchBoolSize(llvm::Value *value, llvm::Type *toType, const char *name) {
-+llvm::Value *FunctionEmitContext::SwitchBoolSize(llvm::Value *value, llvm::Type *toType, const llvm::Twine &name) {
-     if ((value == NULL) || (toType == NULL)) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -2248,20 +2237,18 @@ llvm::Value *FunctionEmitContext::SwitchBoolSize(llvm::Value *value, llvm::Type
-     llvm::Value *newBool = value;
-     if (g->target->getDataLayout()->getTypeSizeInBits(fromType) >
-         g->target->getDataLayout()->getTypeSizeInBits(toType)) {
--        if (name == NULL)
--            name = LLVMGetName(value, "_switchBool");
--        newBool = TruncInst(value, toType, name);
-+        newBool =
-+            TruncInst(value, toType, name.isTriviallyEmpty() ? (llvm::Twine(value->getName()) + "_switchBool") : name);
-     } else if (g->target->getDataLayout()->getTypeSizeInBits(fromType) <
-                g->target->getDataLayout()->getTypeSizeInBits(toType)) {
--        if (name == NULL)
--            name = LLVMGetName(value, "_switchBool");
--        newBool = SExtInst(value, toType, name);
-+        newBool =
-+            SExtInst(value, toType, name.isTriviallyEmpty() ? (llvm::Twine(value->getName()) + "_switchBool") : name);
-     }
- 
-     return newBool;
- }
- 
--llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, const Type *type, const char *name) {
-+llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, const Type *type, const llvm::Twine &name) {
-     if (ptr == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -2270,13 +2257,13 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, const Type *type, c
-     llvm::PointerType *pt = llvm::dyn_cast<llvm::PointerType>(ptr->getType());
-     AssertPos(currentPos, pt != NULL);
- 
--    if (name == NULL)
--        name = LLVMGetName(ptr, "_load");
--
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
--    llvm::LoadInst *inst = new llvm::LoadInst(pt->getPointerElementType(), ptr, name, bblock);
-+    llvm::LoadInst *inst =
-+        new llvm::LoadInst(pt->getPointerElementType(), ptr,
-+                           name.isTriviallyEmpty() ? (llvm::Twine(ptr->getName()) + "_load") : name, bblock);
- #else
--    llvm::LoadInst *inst = new llvm::LoadInst(ptr, name, bblock);
-+    llvm::LoadInst *inst =
-+        new llvm::LoadInst(ptr, name.isTriviallyEmpty() ? (llvm::Twine(ptr->getName()) + "_load") : name, bblock);
- #endif
- 
-     if (g->opt.forceAlignedMemory && llvm::dyn_cast<llvm::VectorType>(pt->getElementType())) {
-@@ -2307,8 +2294,8 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, const Type *type, c
- static llvm::Value *lFinalSliceOffset(FunctionEmitContext *ctx, llvm::Value *ptr, const PointerType **ptrType) {
-     Assert(CastType<PointerType>(*ptrType) != NULL);
- 
--    llvm::Value *slicePtr = ctx->ExtractInst(ptr, 0, LLVMGetName(ptr, "_ptr"));
--    llvm::Value *sliceOffset = ctx->ExtractInst(ptr, 1, LLVMGetName(ptr, "_offset"));
-+    llvm::Value *slicePtr = ctx->ExtractInst(ptr, 0, llvm::Twine(ptr->getName()) + "_ptr");
-+    llvm::Value *sliceOffset = ctx->ExtractInst(ptr, 1, llvm::Twine(ptr->getName()) + "_offset");
- 
-     // slicePtr should be a pointer to an soa-width wide array of the
-     // final atomic/enum/pointer type
-@@ -2327,14 +2314,14 @@ static llvm::Value *lFinalSliceOffset(FunctionEmitContext *ctx, llvm::Value *ptr
-         slicePtr = ctx->BitCastInst(slicePtr, (*ptrType)->LLVMType(g->ctx));
- 
-     // And finally index based on the slice offset
--    return ctx->GetElementPtrInst(slicePtr, sliceOffset, *ptrType, LLVMGetName(slicePtr, "_final_gep"));
-+    return ctx->GetElementPtrInst(slicePtr, sliceOffset, *ptrType, llvm::Twine(slicePtr->getName()) + "_final_gep");
- }
- 
- /** Utility routine that loads from a uniform pointer to soa<> data,
-     returning a regular uniform (non-SOA result).
-  */
- llvm::Value *FunctionEmitContext::loadUniformFromSOA(llvm::Value *ptr, llvm::Value *mask, const PointerType *ptrType,
--                                                     const char *name) {
-+                                                     const llvm::Twine &name) {
-     const Type *unifType = ptrType->GetBaseType()->GetAsUniformType();
- 
-     const CollectionType *ct = CastType<CollectionType>(ptrType->GetBaseType());
-@@ -2363,7 +2350,7 @@ llvm::Value *FunctionEmitContext::loadUniformFromSOA(llvm::Value *ptr, llvm::Val
- }
- 
- llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask, const Type *ptrRefType,
--                                           const char *name, bool one_elem) {
-+                                           const llvm::Twine &name, bool one_elem) {
-     if (ptr == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -2371,9 +2358,6 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
- 
-     AssertPos(currentPos, ptrRefType != NULL && mask != NULL);
- 
--    if (name == NULL)
--        name = LLVMGetName(ptr, "_load");
--
-     const PointerType *ptrType;
-     const Type *elType;
-     if (CastType<ReferenceType>(ptrRefType) != NULL) {
-@@ -2393,7 +2377,8 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
- 
-     if (ptrType->IsUniformType()) {
-         if (ptrType->IsSlice()) {
--            return loadUniformFromSOA(ptr, mask, ptrType, name);
-+            return loadUniformFromSOA(ptr, mask, ptrType,
-+                                      name.isTriviallyEmpty() ? (llvm::Twine(ptr->getName()) + "_load") : name);
-         } else {
-             // FIXME: same issue as above load inst regarding alignment...
-             //
-@@ -2405,11 +2390,15 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
-             const AtomicType *atomicType = CastType<AtomicType>(ptrType->GetBaseType());
- 
- #if ISPC_LLVM_VERSION <= ISPC_LLVM_10_0
--            llvm::LoadInst *inst = new llvm::LoadInst(ptr, name, false /* not volatile */, bblock);
-+            llvm::LoadInst *inst =
-+                new llvm::LoadInst(ptr, name.isTriviallyEmpty() ? (llvm::Twine(ptr->getName()) + "_load") : name,
-+                                   false /* not volatile */, bblock);
- #else // LLVM 11.0+
-             llvm::PointerType *ptr_type = llvm::dyn_cast<llvm::PointerType>(ptr->getType());
-             llvm::LoadInst *inst =
--                new llvm::LoadInst(ptr_type->getPointerElementType(), ptr, name, false /* not volatile */, bblock);
-+                new llvm::LoadInst(ptr_type->getPointerElementType(), ptr,
-+                                   name.isTriviallyEmpty() ? (llvm::Twine(ptr->getName()) + "_load") : name,
-+                                   false /* not volatile */, bblock);
- #endif
- 
-             if (atomicType != NULL && atomicType->IsVaryingType()) {
-@@ -2433,7 +2422,8 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
-     } else {
-         // Otherwise we should have a varying ptr and it's time for a
-         // gather.
--        llvm::Value *gather_result = gather(ptr, ptrType, GetFullMask(), name);
-+        llvm::Value *gather_result = gather(ptr, ptrType, GetFullMask(),
-+                                            name.isTriviallyEmpty() ? (llvm::Twine(ptr->getName()) + "_load") : name);
-         if (!one_elem)
-             return gather_result;
- 
-@@ -2453,19 +2443,19 @@ llvm::Value *FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask,
-         // We can actually call either one, since both are i32s as far as
-         // LLVM's type system is concerned...
-         llvm::Function *fmm = mm[0]->function;
--        llvm::Value *int_mask = CallInst(fmm, NULL, mask, LLVMGetName(mask, "_movmsk"));
-+        llvm::Value *int_mask = CallInst(fmm, NULL, mask, llvm::Twine(mask->getName()) + "_movmsk");
-         std::vector<Symbol *> lz;
-         m->symbolTable->LookupFunction("__count_trailing_zeros_i64", &lz);
-         llvm::Function *flz = lz[0]->function;
--        llvm::Value *elem_idx = CallInst(flz, NULL, int_mask, LLVMGetName(mask, "_clz"));
--        llvm::Value *elem = llvm::ExtractElementInst::Create(gather_result, elem_idx,
--                                                             LLVMGetName(gather_result, "_umasked_elem"), bblock);
-+        llvm::Value *elem_idx = CallInst(flz, NULL, int_mask, llvm::Twine(mask->getName()) + "_clz");
-+        llvm::Value *elem = llvm::ExtractElementInst::Create(
-+            gather_result, elem_idx, llvm::Twine(gather_result->getName()) + "_umasked_elem", bblock);
-         return elem;
-     }
- }
- 
- llvm::Value *FunctionEmitContext::gather(llvm::Value *ptr, const PointerType *ptrType, llvm::Value *mask,
--                                         const char *name) {
-+                                         const llvm::Twine &name) {
-     // We should have a varying pointer if we get here...
-     AssertPos(currentPos, ptrType->IsVaryingType());
- 
-@@ -2602,7 +2592,8 @@ void FunctionEmitContext::addGSMetadata(llvm::Value *v, SourcePos pos) {
-     inst->setMetadata("last_column", md);
- }
- 
--llvm::Value *FunctionEmitContext::AllocaInst(llvm::Type *llvmType, const char *name, int align, bool atEntryBlock) {
-+llvm::Value *FunctionEmitContext::AllocaInst(llvm::Type *llvmType, const llvm::Twine &name, int align,
-+                                             bool atEntryBlock) {
-     if (llvmType == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -2615,12 +2606,12 @@ llvm::Value *FunctionEmitContext::AllocaInst(llvm::Type *llvmType, const char *n
-         llvm::Instruction *retInst = allocaBlock->getTerminator();
-         AssertPos(currentPos, retInst);
-         unsigned AS = llvmFunction->getParent()->getDataLayout().getAllocaAddrSpace();
--        inst = new llvm::AllocaInst(llvmType, AS, name ? name : "", retInst);
-+        inst = new llvm::AllocaInst(llvmType, AS, name, retInst);
-     } else {
-         // Unless the caller overrode the default and wants it in the
-         // current basic block
-         unsigned AS = llvmFunction->getParent()->getDataLayout().getAllocaAddrSpace();
--        inst = new llvm::AllocaInst(llvmType, AS, name ? name : "", bblock);
-+        inst = new llvm::AllocaInst(llvmType, AS, name, bblock);
-     }
- 
-     // If no alignment was specified but we have an array of a uniform
-@@ -2639,7 +2630,8 @@ llvm::Value *FunctionEmitContext::AllocaInst(llvm::Type *llvmType, const char *n
-     return inst;
- }
- 
--llvm::Value *FunctionEmitContext::AllocaInst(const Type *ptrType, const char *name, int align, bool atEntryBlock) {
-+llvm::Value *FunctionEmitContext::AllocaInst(const Type *ptrType, const llvm::Twine &name, int align,
-+                                             bool atEntryBlock) {
-     if (ptrType == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -3075,66 +3067,59 @@ llvm::Instruction *FunctionEmitContext::BranchInst(llvm::BasicBlock *trueBlock,
-     return b;
- }
- 
--llvm::Value *FunctionEmitContext::ExtractInst(llvm::Value *v, int elt, const char *name) {
-+llvm::Value *FunctionEmitContext::ExtractInst(llvm::Value *v, int elt, const llvm::Twine &name) {
-     if (v == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL) {
--        char buf[32];
--        snprintf(buf, sizeof(buf), "_extract_%d", elt);
--        name = LLVMGetName(v, buf);
--    }
-     llvm::Instruction *ei = NULL;
-     if (llvm::isa<llvm::VectorType>(v->getType()))
--        ei = llvm::ExtractElementInst::Create(v, LLVMInt32(elt), name, bblock);
-+        ei = llvm::ExtractElementInst::Create(
-+            v, LLVMInt32(elt),
-+            name.isTriviallyEmpty() ? ((llvm::Twine(v->getName()) + "_extract_") + llvm::Twine(elt)) : name, bblock);
-     else
--        ei = llvm::ExtractValueInst::Create(v, elt, name, bblock);
-+        ei = llvm::ExtractValueInst::Create(
-+            v, elt, name.isTriviallyEmpty() ? ((llvm::Twine(v->getName()) + "_extract_") + llvm::Twine(elt)) : name,
-+            bblock);
-     AddDebugPos(ei);
-     return ei;
- }
- 
--llvm::Value *FunctionEmitContext::InsertInst(llvm::Value *v, llvm::Value *eltVal, int elt, const char *name) {
-+llvm::Value *FunctionEmitContext::InsertInst(llvm::Value *v, llvm::Value *eltVal, int elt, const llvm::Twine &name) {
-     if (v == NULL || eltVal == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL) {
--        char buf[32];
--        snprintf(buf, sizeof(buf), "_insert_%d", elt);
--        name = LLVMGetName(v, buf);
--    }
--
-     llvm::Instruction *ii = NULL;
-     if (llvm::isa<llvm::VectorType>(v->getType()))
--        ii = llvm::InsertElementInst::Create(v, eltVal, LLVMInt32(elt), name, bblock);
-+        ii = llvm::InsertElementInst::Create(
-+            v, eltVal, LLVMInt32(elt),
-+            name.isTriviallyEmpty() ? ((llvm::Twine(v->getName()) + "_insert_") + llvm::Twine(elt)) : name, bblock);
-     else
--        ii = llvm::InsertValueInst::Create(v, eltVal, elt, name, bblock);
-+        ii = llvm::InsertValueInst::Create(
-+            v, eltVal, elt,
-+            name.isTriviallyEmpty() ? ((llvm::Twine(v->getName()) + "_insert_") + llvm::Twine(elt)) : name, bblock);
-     AddDebugPos(ii);
-     return ii;
- }
- 
--llvm::Value *FunctionEmitContext::ShuffleInst(llvm::Value *v1, llvm::Value *v2, llvm::Value *mask, const char *name) {
-+llvm::Value *FunctionEmitContext::ShuffleInst(llvm::Value *v1, llvm::Value *v2, llvm::Value *mask,
-+                                              const llvm::Twine &name) {
-     if (v1 == NULL || v2 == NULL || mask == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL) {
--        char buf[32];
--        snprintf(buf, sizeof(buf), "_shuffle");
--        name = LLVMGetName(v1, buf);
--    }
--
--    llvm::Instruction *ii = new llvm::ShuffleVectorInst(v1, v2, mask, name, bblock);
-+    llvm::Instruction *ii = new llvm::ShuffleVectorInst(
-+        v1, v2, mask, name.isTriviallyEmpty() ? (llvm::Twine(v1->getName()) + "_shuffle") : name, bblock);
- 
-     AddDebugPos(ii);
-     return ii;
- }
- 
--llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vecType, const char *name) {
-+llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vecType, const llvm::Twine &name) {
-     if (v == NULL || vecType == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -3148,12 +3133,6 @@ llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vec
-     Assert(ty && ty->getVectorElementType() == v->getType());
- #endif
- 
--    if (name == NULL) {
--        char buf[32];
--        snprintf(buf, sizeof(buf), "_broadcast");
--        name = LLVMGetName(v, buf);
--    }
--
-     // Generate the following sequence:
-     //   %name_init.i = insertelement <4 x i32> undef, i32 %val, i32 0
-     //   %name.i = shufflevector <4 x i32> %name_init.i, <4 x i32> undef,
-@@ -3163,7 +3142,7 @@ llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vec
-     llvm::Value *undef2 = llvm::UndefValue::get(vecType);
- 
-     // InsertElement
--    llvm::Twine tw = llvm::Twine(name) + llvm::Twine("_init");
-+    llvm::Twine tw = name.isTriviallyEmpty() ? (llvm::Twine(v->getName()) + "_broadcast") : name + llvm::Twine("_init");
-     llvm::Value *insert = InsertInst(undef1, v, 0, tw.str().c_str());
- 
-     // ShuffleVector
-@@ -3179,28 +3158,27 @@ llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vec
-         llvm::ConstantVector::getSplat(llvm::ElementCount::get(static_cast<unsigned int>(ty->getNumElements()), false),
-                                        llvm::Constant::getNullValue(llvm::Type::getInt32Ty(*g->ctx)));
- #endif
--    llvm::Value *ret = ShuffleInst(insert, undef2, zeroVec, name);
-+    llvm::Value *ret = ShuffleInst(insert, undef2, zeroVec,
-+                                   name.isTriviallyEmpty() ? (llvm::Twine(v->getName()) + "_broadcast") : name);
- 
-     return ret;
- }
- 
--llvm::PHINode *FunctionEmitContext::PhiNode(llvm::Type *type, int count, const char *name) {
--    llvm::PHINode *pn = llvm::PHINode::Create(type, count, name ? name : "phi", bblock);
-+llvm::PHINode *FunctionEmitContext::PhiNode(llvm::Type *type, int count, const llvm::Twine &name) {
-+    llvm::PHINode *pn = llvm::PHINode::Create(type, count, name.isTriviallyEmpty() ? "phi" : name, bblock);
-     AddDebugPos(pn);
-     return pn;
- }
- 
- llvm::Instruction *FunctionEmitContext::SelectInst(llvm::Value *test, llvm::Value *val0, llvm::Value *val1,
--                                                   const char *name) {
-+                                                   const llvm::Twine &name) {
-     if (test == NULL || val0 == NULL || val1 == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-     }
- 
--    if (name == NULL)
--        name = LLVMGetName(test, "_select");
--
--    llvm::Instruction *inst = llvm::SelectInst::Create(test, val0, val1, name, bblock);
-+    llvm::Instruction *inst = llvm::SelectInst::Create(
-+        test, val0, val1, name.isTriviallyEmpty() ? (llvm::Twine(test->getName()) + "_select") : name, bblock);
-     AddDebugPos(inst);
-     return inst;
- }
-@@ -3226,7 +3204,7 @@ static unsigned int lCalleeArgCount(llvm::Value *callee, const FunctionType *fun
- }
- 
- llvm::Value *FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType *funcType,
--                                           const std::vector<llvm::Value *> &args, const char *name) {
-+                                           const std::vector<llvm::Value *> &args, const llvm::Twine &name) {
-     if (func == NULL) {
-         AssertPos(currentPos, m->errorCount > 0);
-         return NULL;
-@@ -3258,9 +3236,9 @@ llvm::Value *FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType
- #if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-         llvm::PointerType *func_ptr_type = llvm::dyn_cast<llvm::PointerType>(func->getType());
-         llvm::FunctionType *func_type = llvm::dyn_cast<llvm::FunctionType>(func_ptr_type->getPointerElementType());
--        llvm::CallInst *callinst = llvm::CallInst::Create(func_type, func, argVals, name ? name : "", bblock);
-+        llvm::CallInst *callinst = llvm::CallInst::Create(func_type, func, argVals, name, bblock);
- #else
--        llvm::CallInst *callinst = llvm::CallInst::Create(func, argVals, name ? name : "", bblock);
-+        llvm::CallInst *callinst = llvm::CallInst::Create(func, argVals, name, bblock);
- #endif
- 
-         // We could be dealing with a function pointer in which case this will not be a 'llvm::Function'.
-@@ -3464,14 +3442,14 @@ llvm::Value *FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType
- }
- 
- llvm::Value *FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType *funcType, llvm::Value *arg,
--                                           const char *name) {
-+                                           const llvm::Twine &name) {
-     std::vector<llvm::Value *> args;
-     args.push_back(arg);
-     return CallInst(func, funcType, args, name);
- }
- 
- llvm::Value *FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType *funcType, llvm::Value *arg0,
--                                           llvm::Value *arg1, const char *name) {
-+                                           llvm::Value *arg1, const llvm::Twine &name) {
-     std::vector<llvm::Value *> args;
-     args.push_back(arg0);
-     args.push_back(arg1);
-diff --git a/src/ctx.h b/src/ctx.h
-index 6e5ad74ba..48b3bb826 100644
---- a/src/ctx.h
-+++ b/src/ctx.h
-@@ -302,7 +302,7 @@ class FunctionEmitContext {
-     llvm::Value *GetStringPtr(const std::string &str);
- 
-     /** Create a new basic block with given name */
--    llvm::BasicBlock *CreateBasicBlock(const char *name, llvm::BasicBlock *insertAfter = NULL);
-+    llvm::BasicBlock *CreateBasicBlock(const llvm::Twine &name, llvm::BasicBlock *insertAfter = NULL);
- 
-     /** Given a vector with element type i1, return a vector of type
-         LLVMTypes::BoolVectorType.  This method handles the conversion for
-@@ -380,33 +380,33 @@ class FunctionEmitContext {
-         this also handles applying the given operation to the vector
-         elements. */
-     llvm::Value *BinaryOperator(llvm::Instruction::BinaryOps inst, llvm::Value *v0, llvm::Value *v1,
--                                const char *name = NULL);
-+                                const llvm::Twine &name = "");
- 
-     /** Emit the "not" operator.  Like BinaryOperator(), this also handles
-         a VectorType-based operand. */
--    llvm::Value *NotOperator(llvm::Value *v, const char *name = NULL);
-+    llvm::Value *NotOperator(llvm::Value *v, const llvm::Twine &name = "");
- 
-     /** Emit a comparison instruction.  If the operands are VectorTypes,
-         then a value for the corresponding boolean VectorType is
-         returned. */
-     llvm::Value *CmpInst(llvm::Instruction::OtherOps inst, llvm::CmpInst::Predicate pred, llvm::Value *v0,
--                         llvm::Value *v1, const char *name = NULL);
-+                         llvm::Value *v1, const llvm::Twine &name = "");
- 
-     /** Given a scalar value, return a vector of the same type (or an
-         array, for pointer types). */
--    llvm::Value *SmearUniform(llvm::Value *value, const char *name = NULL);
-+    llvm::Value *SmearUniform(llvm::Value *value, const llvm::Twine &name = "");
- 
--    llvm::Value *BitCastInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
--    llvm::Value *PtrToIntInst(llvm::Value *value, const char *name = NULL);
--    llvm::Value *PtrToIntInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
--    llvm::Value *IntToPtrInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
-+    llvm::Value *BitCastInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
-+    llvm::Value *PtrToIntInst(llvm::Value *value, const llvm::Twine &name = "");
-+    llvm::Value *PtrToIntInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
-+    llvm::Value *IntToPtrInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
- 
--    llvm::Instruction *TruncInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
-+    llvm::Instruction *TruncInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
-     llvm::Instruction *CastInst(llvm::Instruction::CastOps op, llvm::Value *value, llvm::Type *type,
--                                const char *name = NULL);
--    llvm::Instruction *FPCastInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
--    llvm::Instruction *SExtInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
--    llvm::Instruction *ZExtInst(llvm::Value *value, llvm::Type *type, const char *name = NULL);
-+                                const llvm::Twine &name = "");
-+    llvm::Instruction *FPCastInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
-+    llvm::Instruction *SExtInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
-+    llvm::Instruction *ZExtInst(llvm::Value *value, llvm::Type *type, const llvm::Twine &name = "");
- 
-     /** Given two integer-typed values (but possibly one vector and the
-         other not, and or of possibly-different bit-widths), update their
-@@ -426,9 +426,9 @@ class FunctionEmitContext {
-         pointers.  The underlying type of the base pointer must be provided
-         via the ptrType parameter */
-     llvm::Value *GetElementPtrInst(llvm::Value *basePtr, llvm::Value *index, const Type *ptrType,
--                                   const char *name = NULL);
-+                                   const llvm::Twine &name = "");
-     llvm::Value *GetElementPtrInst(llvm::Value *basePtr, llvm::Value *index0, llvm::Value *index1, const Type *ptrType,
--                                   const char *name = NULL);
-+                                   const llvm::Twine &name = "");
- 
-     /** This method returns a new pointer that represents offsetting the
-         given base pointer to point at the given element number of the
-@@ -436,26 +436,26 @@ class FunctionEmitContext {
-         pointer must be a pointer to a structure type.  The ptrType gives
-         the type of the pointer, though it may be NULL if the base pointer
-         is uniform. */
--    llvm::Value *AddElementOffset(llvm::Value *basePtr, int elementNum, const Type *ptrType, const char *name = NULL,
--                                  const PointerType **resultPtrType = NULL);
-+    llvm::Value *AddElementOffset(llvm::Value *basePtr, int elementNum, const Type *ptrType,
-+                                  const llvm::Twine &name = "", const PointerType **resultPtrType = NULL);
- 
-     /** Bool is stored as i8 and <WIDTH x i8> but represented in IR as i1 and
-      * <WIDTH x MASK>. This is a helper function to match bool size at storage
-      * interface. */
--    llvm::Value *SwitchBoolSize(llvm::Value *value, llvm::Type *toType, const char *name = NULL);
-+    llvm::Value *SwitchBoolSize(llvm::Value *value, llvm::Type *toType, const llvm::Twine &name = "");
-     /** Load from the memory location(s) given by lvalue, using the given
-         mask.  The lvalue may be varying, in which case this corresponds to
-         a gather from the multiple memory locations given by the array of
-         pointer values given by the lvalue.  If the lvalue is not varying,
-         then both the mask pointer and the type pointer may be NULL. */
--    llvm::Value *LoadInst(llvm::Value *ptr, llvm::Value *mask, const Type *ptrType, const char *name = NULL,
-+    llvm::Value *LoadInst(llvm::Value *ptr, llvm::Value *mask, const Type *ptrType, const llvm::Twine &name = "",
-                           bool one_elem = false);
- 
-     /* Load from memory location(s) given.
-      * 'type' needs to be provided when storage type is different from IR type. For example,
-      * 'unform bool' is 'i1' in IR but stored as 'i8'.
-      * Otherwise leave this as NULL. */
--    llvm::Value *LoadInst(llvm::Value *ptr, const Type *type = NULL, const char *name = NULL);
-+    llvm::Value *LoadInst(llvm::Value *ptr, const Type *type = NULL, const llvm::Twine &name = "");
- 
-     /** Emits an alloca instruction to allocate stack storage for the given
-         type.  If a non-zero alignment is specified, the object is also
-@@ -463,7 +463,8 @@ class FunctionEmitContext {
-         instruction is added at the start of the function in the entry
-         basic block; if it should be added to the current basic block, then
-         the atEntryBlock parameter should be false. */
--    llvm::Value *AllocaInst(llvm::Type *llvmType, const char *name = NULL, int align = 0, bool atEntryBlock = true);
-+    llvm::Value *AllocaInst(llvm::Type *llvmType, const llvm::Twine &name = "", int align = 0,
-+                            bool atEntryBlock = true);
- 
-     /** Emits an alloca instruction to allocate stack storage for the given
-         type.  If a non-zero alignment is specified, the object is also
-@@ -474,7 +475,7 @@ class FunctionEmitContext {
-         This implementation is preferred when possible. It is needed when
-         storage type is different from IR type. For example,
-         'unform bool' is 'i1' in IR but stored as 'i8'. */
--    llvm::Value *AllocaInst(const Type *ptrType, const char *name = NULL, int align = 0, bool atEntryBlock = true);
-+    llvm::Value *AllocaInst(const Type *ptrType, const llvm::Twine &name = "", int align = 0, bool atEntryBlock = true);
- 
-     /** Standard store instruction; for this variant, the lvalue must be a
-         single pointer, not a varying lvalue.
-@@ -502,39 +503,41 @@ class FunctionEmitContext {
-     /** This convenience method maps to an llvm::ExtractElementInst if the
-         given value is a llvm::VectorType, and to an llvm::ExtractValueInst
-         otherwise. */
--    llvm::Value *ExtractInst(llvm::Value *v, int elt, const char *name = NULL);
-+    llvm::Value *ExtractInst(llvm::Value *v, int elt, const llvm::Twine &name = "");
- 
-     /** This convenience method maps to an llvm::InsertElementInst if the
-         given value is a llvm::VectorType, and to an llvm::InsertValueInst
-         otherwise. */
--    llvm::Value *InsertInst(llvm::Value *v, llvm::Value *eltVal, int elt, const char *name = NULL);
-+    llvm::Value *InsertInst(llvm::Value *v, llvm::Value *eltVal, int elt, const llvm::Twine &name = "");
- 
-     /** This convenience method maps to an llvm::ShuffleVectorInst. */
--    llvm::Value *ShuffleInst(llvm::Value *v1, llvm::Value *v2, llvm::Value *mask, const char *name = NULL);
-+    llvm::Value *ShuffleInst(llvm::Value *v1, llvm::Value *v2, llvm::Value *mask, const llvm::Twine &name = "");
- 
-     /** This convenience method to generate broadcast pattern. It takes a value
-         and a vector type. Type of the value must match element type of the
-         vector. */
--    llvm::Value *BroadcastValue(llvm::Value *v, llvm::Type *vecType, const char *name = NULL);
-+    llvm::Value *BroadcastValue(llvm::Value *v, llvm::Type *vecType, const llvm::Twine &name = "");
- 
--    llvm::PHINode *PhiNode(llvm::Type *type, int count, const char *name = NULL);
--    llvm::Instruction *SelectInst(llvm::Value *test, llvm::Value *val0, llvm::Value *val1, const char *name = NULL);
-+    llvm::PHINode *PhiNode(llvm::Type *type, int count, const llvm::Twine &name = "");
-+    llvm::Instruction *SelectInst(llvm::Value *test, llvm::Value *val0, llvm::Value *val1,
-+                                  const llvm::Twine &name = "");
- 
-     /** Emits IR to do a function call with the given arguments.  If the
-         function type is a varying function pointer type, its full type
-         must be provided in funcType.  funcType can be NULL if func is a
-         uniform function pointer. */
-     llvm::Value *CallInst(llvm::Value *func, const FunctionType *funcType, const std::vector<llvm::Value *> &args,
--                          const char *name = NULL);
-+                          const llvm::Twine &name = "");
- 
-     /** This is a convenience method that issues a call instruction to a
-         function that takes just a single argument. */
--    llvm::Value *CallInst(llvm::Value *func, const FunctionType *funcType, llvm::Value *arg, const char *name = NULL);
-+    llvm::Value *CallInst(llvm::Value *func, const FunctionType *funcType, llvm::Value *arg,
-+                          const llvm::Twine &name = "");
- 
-     /** This is a convenience method that issues a call instruction to a
-         function that takes two arguments. */
-     llvm::Value *CallInst(llvm::Value *func, const FunctionType *funcType, llvm::Value *arg0, llvm::Value *arg1,
--                          const char *name = NULL);
-+                          const llvm::Twine &name = "");
- 
-     /** Launch an asynchronous task to run the given function, passing it
-         he given argument values. */
-@@ -756,9 +759,10 @@ class FunctionEmitContext {
-     void maskedStore(llvm::Value *value, llvm::Value *ptr, const Type *ptrType, llvm::Value *mask);
-     void storeUniformToSOA(llvm::Value *value, llvm::Value *ptr, llvm::Value *mask, const Type *valueType,
-                            const PointerType *ptrType);
--    llvm::Value *loadUniformFromSOA(llvm::Value *ptr, llvm::Value *mask, const PointerType *ptrType, const char *name);
-+    llvm::Value *loadUniformFromSOA(llvm::Value *ptr, llvm::Value *mask, const PointerType *ptrType,
-+                                    const llvm::Twine &name = "");
- 
--    llvm::Value *gather(llvm::Value *ptr, const PointerType *ptrType, llvm::Value *mask, const char *name);
-+    llvm::Value *gather(llvm::Value *ptr, const PointerType *ptrType, llvm::Value *mask, const llvm::Twine &name = "");
- 
-     llvm::Value *addVaryingOffsetsIfNeeded(llvm::Value *ptr, const Type *ptrType);
- };
-diff --git a/src/expr.cpp b/src/expr.cpp
-index 80cc3020a..6d38d1889 100644
---- a/src/expr.cpp
-+++ b/src/expr.cpp
-@@ -1021,11 +1021,11 @@ static llvm::Value *lEmitNegate(Expr *arg, SourcePos pos, FunctionEmitContext *c
-     ctx->SetDebugPos(pos);
-     if (type->IsFloatType()) {
-         llvm::Value *zero = llvm::ConstantFP::getZeroValueForNegation(type->LLVMType(g->ctx));
--        return ctx->BinaryOperator(llvm::Instruction::FSub, zero, argVal, LLVMGetName(argVal, "_negate"));
-+        return ctx->BinaryOperator(llvm::Instruction::FSub, zero, argVal, llvm::Twine(argVal->getName()) + "_negate");
-     } else {
-         llvm::Value *zero = lLLVMConstantValue(type, g->ctx, 0.);
-         AssertPos(pos, type->IsIntType());
--        return ctx->BinaryOperator(llvm::Instruction::Sub, zero, argVal, LLVMGetName(argVal, "_negate"));
-+        return ctx->BinaryOperator(llvm::Instruction::Sub, zero, argVal, llvm::Twine(argVal->getName()) + "_negate");
-     }
- }
- 
-@@ -1047,11 +1047,11 @@ llvm::Value *UnaryExpr::GetValue(FunctionEmitContext *ctx) const {
-         return lEmitNegate(expr, pos, ctx);
-     case LogicalNot: {
-         llvm::Value *argVal = expr->GetValue(ctx);
--        return ctx->NotOperator(argVal, LLVMGetName(argVal, "_logicalnot"));
-+        return ctx->NotOperator(argVal, llvm::Twine(argVal->getName()) + "_logicalnot");
-     }
-     case BitNot: {
-         llvm::Value *argVal = expr->GetValue(ctx);
--        return ctx->NotOperator(argVal, LLVMGetName(argVal, "_bitnot"));
-+        return ctx->NotOperator(argVal, llvm::Twine(argVal->getName()) + "_bitnot");
-     }
-     default:
-         FATAL("logic error");
-@@ -1518,7 +1518,8 @@ static llvm::Value *lEmitBinaryArith(BinaryExpr::Op op, llvm::Value *value0, llv
-             return NULL;
-         }
- 
--        return ctx->BinaryOperator(inst, value0, value1, LLVMGetName(opName, value0, value1));
-+        return ctx->BinaryOperator(inst, value0, value1,
-+                                   (((llvm::Twine(opName) + "_") + value0->getName()) + "_") + value1->getName());
-     }
- }
- 
-@@ -1563,7 +1564,7 @@ static llvm::Value *lEmitBinaryCmp(BinaryExpr::Op op, llvm::Value *e0Val, llvm::
-     }
- 
-     llvm::Value *cmp = ctx->CmpInst(isFloatOp ? llvm::Instruction::FCmp : llvm::Instruction::ICmp, pred, e0Val, e1Val,
--                                    LLVMGetName(opName, e0Val, e1Val));
-+                                    (((llvm::Twine(opName) + "_") + e0Val->getName()) + "_") + e1Val->getName());
-     // This is a little ugly: CmpInst returns i1 values, but we use vectors
-     // of i32s for varying bool values; type convert the result here if
-     // needed.
-@@ -4177,7 +4178,7 @@ static llvm::Value *lConvertToSlicePointer(FunctionEmitContext *ctx, llvm::Value
-     // offsets
-     llvm::Value *result = llvm::Constant::getNullValue(sliceStructType);
-     // And replace the pointer in the struct with the given pointer
--    return ctx->InsertInst(result, ptr, 0, LLVMGetName(ptr, "_slice"));
-+    return ctx->InsertInst(result, ptr, 0, llvm::Twine(ptr->getName()) + "_slice");
- }
- 
- /** If the given array index is a compile time constant, check to see if it
-@@ -4258,8 +4259,8 @@ llvm::Value *IndexExpr::GetLValue(FunctionEmitContext *ctx) const {
-         // Convert to a slice pointer if we're indexing into SOA data
-         basePtrValue = lConvertPtrToSliceIfNeeded(ctx, basePtrValue, &baseExprType);
- 
--        llvm::Value *ptr =
--            ctx->GetElementPtrInst(basePtrValue, indexValue, baseExprType, LLVMGetName(basePtrValue, "_offset"));
-+        llvm::Value *ptr = ctx->GetElementPtrInst(basePtrValue, indexValue, baseExprType,
-+                                                  llvm::Twine(basePtrValue->getName()) + "_offset");
-         return lAddVaryingOffsetsIfNeeded(ctx, ptr, GetLValueType());
-     }
- 
-@@ -4290,8 +4291,8 @@ llvm::Value *IndexExpr::GetLValue(FunctionEmitContext *ctx) const {
-     ctx->SetDebugPos(pos);
- 
-     // And do the actual indexing calculation..
--    llvm::Value *ptr =
--        ctx->GetElementPtrInst(basePtr, LLVMInt32(0), indexValue, basePtrType, LLVMGetName(basePtr, "_offset"));
-+    llvm::Value *ptr = ctx->GetElementPtrInst(basePtr, LLVMInt32(0), indexValue, basePtrType,
-+                                              llvm::Twine(basePtr->getName()) + "_offset");
-     return lAddVaryingOffsetsIfNeeded(ctx, ptr, GetLValueType());
- }
- 
-@@ -4788,15 +4789,14 @@ llvm::Value *VectorMemberExpr::GetValue(FunctionEmitContext *ctx) const {
-         for (size_t i = 0; i < identifier.size(); ++i) {
-             char idStr[2] = {identifier[i], '\0'};
-             llvm::Value *elementPtr =
--                ctx->AddElementOffset(basePtr, indices[i], basePtrType, LLVMGetName(basePtr, idStr));
-+                ctx->AddElementOffset(basePtr, indices[i], basePtrType, llvm::Twine(basePtr->getName()) + idStr);
-             llvm::Value *elementValue = ctx->LoadInst(elementPtr, elementMask, elementPtrType);
- 
--            const char *resultName = LLVMGetName(resultPtr, idStr);
--            llvm::Value *ptmp = ctx->AddElementOffset(resultPtr, i, NULL, resultName);
-+            llvm::Value *ptmp = ctx->AddElementOffset(resultPtr, i, NULL, llvm::Twine(resultPtr->getName()) + idStr);
-             ctx->StoreInst(elementValue, ptmp, elementPtrType, expr->GetType()->IsUniformType());
-         }
- 
--        return ctx->LoadInst(resultPtr, memberType, LLVMGetName(basePtr, "_swizzle"));
-+        return ctx->LoadInst(resultPtr, memberType, llvm::Twine(basePtr->getName()) + "_swizzle");
-     }
- }
- 
-@@ -4932,7 +4932,7 @@ llvm::Value *MemberExpr::GetValue(FunctionEmitContext *ctx) const {
- 
-     ctx->SetDebugPos(pos);
-     std::string suffix = std::string("_") + identifier;
--    return ctx->LoadInst(lvalue, mask, lvalueType, LLVMGetName(lvalue, suffix.c_str()));
-+    return ctx->LoadInst(lvalue, mask, lvalueType, llvm::Twine(lvalue->getName()) + suffix);
- }
- 
- const Type *MemberExpr::GetType() const { return NULL; }
-@@ -6502,7 +6502,7 @@ static llvm::Value *lTypeConvAtomic(FunctionEmitContext *ctx, llvm::Value *exprV
-                 // does for everyone else...
-                 Assert(cast);
-                 cast = ctx->SwitchBoolSize(cast, LLVMTypes::BoolVectorType->getElementType(),
--                                           LLVMGetName(cast, "to_i_bool"));
-+                                           llvm::Twine(cast->getName()) + "to_i_bool");
-             }
-         } else {
-             // fromType->IsVaryingType())
-@@ -8246,7 +8246,7 @@ llvm::Value *NewExpr::GetValue(FunctionEmitContext *ctx) const {
-         // pointer of the return type and to run the code for initializers,
-         // if present.
-         llvm::Type *ptrType = retType->LLVMType(g->ctx);
--        ptrValue = ctx->BitCastInst(ptrValue, ptrType, LLVMGetName(ptrValue, "_cast_ptr"));
-+        ptrValue = ctx->BitCastInst(ptrValue, ptrType, llvm::Twine(ptrValue->getName()) + "_cast_ptr");
- 
-         if (initExpr != NULL)
-             InitSymbol(ptrValue, allocType, initExpr, ctx, pos);
-diff --git a/src/llvmutil.cpp b/src/llvmutil.cpp
-index 970175dbf..d0becb9f5 100644
---- a/src/llvmutil.cpp
-+++ b/src/llvmutil.cpp
-@@ -1605,23 +1605,6 @@ llvm::Value *LLVMShuffleVectors(llvm::Value *v1, llvm::Value *v2, int32_t shuf[]
-     return new llvm::ShuffleVectorInst(v1, v2, vec, "shuffle", insertBefore);
- }
- 
--const char *LLVMGetName(llvm::Value *v, const char *s) {
--    if (v == NULL)
--        return s;
--    std::string ret = std::string(v->getName());
--    ret += s;
--    return strdup(ret.c_str());
--}
--
--const char *LLVMGetName(const char *op, llvm::Value *v1, llvm::Value *v2) {
--    std::string r = op;
--    r += "_";
--    r += v1->getName().str();
--    r += "_";
--    r += v2->getName().str();
--    return strdup(r.c_str());
--}
--
- #ifdef ISPC_GENX_ENABLED
- bool lIsSVMLoad(llvm::Instruction *inst) {
-     Assert(inst);
-diff --git a/src/llvmutil.h b/src/llvmutil.h
-index 42cce4d83..07d089bb4 100644
---- a/src/llvmutil.h
-+++ b/src/llvmutil.h
-@@ -328,11 +328,6 @@ extern llvm::Value *LLVMConcatVectors(llvm::Value *v1, llvm::Value *v2, llvm::In
- extern llvm::Value *LLVMShuffleVectors(llvm::Value *v1, llvm::Value *v2, int32_t shuf[], int shufSize,
-                                        llvm::Instruction *insertBefore);
- 
--/** Utility routines to concat strings with the names of existing values to
--    create meaningful new names for instruction values.
--*/
--extern const char *LLVMGetName(llvm::Value *v, const char *);
--extern const char *LLVMGetName(const char *op, llvm::Value *v1, llvm::Value *v2);
- #ifdef ISPC_GENX_ENABLED
- enum AddressSpace { Local, Global, External };
- 
-diff --git a/src/opt.cpp b/src/opt.cpp
-index 5b1ac7b63..9d6cae058 100644
---- a/src/opt.cpp
-+++ b/src/opt.cpp
-@@ -257,7 +257,7 @@ static bool lGetSourcePosFromMetadata(const llvm::Instruction *inst, SourcePos *
-     return true;
- }
- 
--static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llvm::Value *arg1, const char *name,
-+static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llvm::Value *arg1, const llvm::Twine &name,
-                                     llvm::Instruction *insertBefore = NULL) {
-     llvm::Value *args[2] = {arg0, arg1};
-     llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[2]);
-@@ -265,21 +265,22 @@ static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llv
- }
- 
- static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llvm::Value *arg1, llvm::Value *arg2,
--                                    const char *name, llvm::Instruction *insertBefore = NULL) {
-+                                    const llvm::Twine &name, llvm::Instruction *insertBefore = NULL) {
-     llvm::Value *args[3] = {arg0, arg1, arg2};
-     llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[3]);
-     return llvm::CallInst::Create(func, newArgArray, name, insertBefore);
- }
- 
- static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llvm::Value *arg1, llvm::Value *arg2,
--                                    llvm::Value *arg3, const char *name, llvm::Instruction *insertBefore = NULL) {
-+                                    llvm::Value *arg3, const llvm::Twine &name,
-+                                    llvm::Instruction *insertBefore = NULL) {
-     llvm::Value *args[4] = {arg0, arg1, arg2, arg3};
-     llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[4]);
-     return llvm::CallInst::Create(func, newArgArray, name, insertBefore);
- }
- 
- static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llvm::Value *arg1, llvm::Value *arg2,
--                                    llvm::Value *arg3, llvm::Value *arg4, const char *name,
-+                                    llvm::Value *arg3, llvm::Value *arg4, const llvm::Twine &name,
-                                     llvm::Instruction *insertBefore = NULL) {
-     llvm::Value *args[5] = {arg0, arg1, arg2, arg3, arg4};
-     llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[5]);
-@@ -287,7 +288,7 @@ static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llv
- }
- 
- static llvm::Instruction *lCallInst(llvm::Function *func, llvm::Value *arg0, llvm::Value *arg1, llvm::Value *arg2,
--                                    llvm::Value *arg3, llvm::Value *arg4, llvm::Value *arg5, const char *name,
-+                                    llvm::Value *arg3, llvm::Value *arg4, llvm::Value *arg5, const llvm::Twine &name,
-                                     llvm::Instruction *insertBefore = NULL) {
-     llvm::Value *args[6] = {arg0, arg1, arg2, arg3, arg4, arg5};
-     llvm::ArrayRef<llvm::Value *> newArgArray(&args[0], &args[6]);
-@@ -991,23 +992,24 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
-                 llvm::Type *returnType = callInst->getType();
-                 Assert(llvm::isa<llvm::VectorType>(returnType));
-                 // cast the i8 * to the appropriate type
--                const char *name = LLVMGetName(callInst->getArgOperand(0), "_cast");
--                llvm::Value *castPtr = new llvm::BitCastInst(callInst->getArgOperand(0),
--                                                             llvm::PointerType::get(returnType, 0), name, callInst);
-+                llvm::Value *castPtr =
-+                    new llvm::BitCastInst(callInst->getArgOperand(0), llvm::PointerType::get(returnType, 0),
-+                                          llvm::Twine(callInst->getArgOperand(0)->getName()) + "_cast", callInst);
-                 lCopyMetadata(castPtr, callInst);
-                 int align;
-                 if (g->opt.forceAlignedMemory)
-                     align = g->target->getNativeVectorAlignment();
-                 else
-                     align = callInst->getCalledFunction() == avxMaskedLoad32 ? 4 : 8;
--                name = LLVMGetName(callInst->getArgOperand(0), "_load");
- #if ISPC_LLVM_VERSION == ISPC_LLVM_10_0
--                llvm::Instruction *loadInst = new llvm::LoadInst(castPtr, name, false /* not volatile */,
--                                                                 llvm::MaybeAlign(align), (llvm::Instruction *)NULL);
-+                llvm::Instruction *loadInst =
-+                    new llvm::LoadInst(castPtr, llvm::Twine(callInst->getArgOperand(0)->getName()) + "_load",
-+                                       false /* not volatile */, llvm::MaybeAlign(align), (llvm::Instruction *)NULL);
- #else
-                 llvm::Instruction *loadInst = new llvm::LoadInst(
--                    llvm::dyn_cast<llvm::PointerType>(castPtr->getType())->getPointerElementType(), castPtr, name,
--                    false /* not volatile */, llvm::MaybeAlign(align).valueOrOne(), (llvm::Instruction *)NULL);
-+                    llvm::dyn_cast<llvm::PointerType>(castPtr->getType())->getPointerElementType(), castPtr,
-+                    llvm::Twine(callInst->getArgOperand(0)->getName()) + "_load", false /* not volatile */,
-+                    llvm::MaybeAlign(align).valueOrOne(), (llvm::Instruction *)NULL);
- #endif
-                 lCopyMetadata(loadInst, callInst);
-                 llvm::ReplaceInstWithInst(callInst, loadInst);
-@@ -1028,9 +1030,9 @@ bool IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
-                 // all lanes storing, so replace with a regular store
-                 llvm::Value *rvalue = callInst->getArgOperand(2);
-                 llvm::Type *storeType = rvalue->getType();
--                const char *name = LLVMGetName(callInst->getArgOperand(0), "_ptrcast");
--                llvm::Value *castPtr = new llvm::BitCastInst(callInst->getArgOperand(0),
--                                                             llvm::PointerType::get(storeType, 0), name, callInst);
-+                llvm::Value *castPtr =
-+                    new llvm::BitCastInst(callInst->getArgOperand(0), llvm::PointerType::get(storeType, 0),
-+                                          llvm::Twine(callInst->getArgOperand(0)->getName()) + "_ptrcast", callInst);
-                 lCopyMetadata(castPtr, callInst);
- 
-                 int align;
-@@ -1339,8 +1341,8 @@ static llvm::Value *lGetBasePointer(llvm::Value *v, llvm::Instruction *insertBef
-         if (t == NULL) {
-             return NULL;
-         } else {
--            return llvm::CastInst::Create(ci->getOpcode(), t, ci->getType()->getScalarType(), LLVMGetName(t, "_cast"),
--                                          insertBefore);
-+            return llvm::CastInst::Create(ci->getOpcode(), t, ci->getType()->getScalarType(),
-+                                          llvm::Twine(t->getName()) + "_cast", insertBefore);
-         }
-     }
- 
-@@ -1583,13 +1585,13 @@ static void lExtractConstantOffset(llvm::Value *vec, llvm::Value **constOffset,
-         if (co == NULL)
-             *constOffset = NULL;
-         else
--            *constOffset =
--                llvm::CastInst::Create(cast->getOpcode(), co, cast->getType(), LLVMGetName(co, "_cast"), insertBefore);
-+            *constOffset = llvm::CastInst::Create(cast->getOpcode(), co, cast->getType(),
-+                                                  llvm::Twine(co->getName()) + "_cast", insertBefore);
-         if (vo == NULL)
-             *variableOffset = NULL;
-         else
--            *variableOffset =
--                llvm::CastInst::Create(cast->getOpcode(), vo, cast->getType(), LLVMGetName(vo, "_cast"), insertBefore);
-+            *variableOffset = llvm::CastInst::Create(cast->getOpcode(), vo, cast->getType(),
-+                                                     llvm::Twine(vo->getName()) + "_cast", insertBefore);
-         return;
-     }
- 
-@@ -1608,16 +1610,18 @@ static void lExtractConstantOffset(llvm::Value *vec, llvm::Value **constOffset,
-             else if (c1 == NULL || llvm::isa<llvm::ConstantAggregateZero>(c1))
-                 *constOffset = c0;
-             else
--                *constOffset = llvm::BinaryOperator::Create(llvm::Instruction::Add, c0, c1, LLVMGetName("add", c0, c1),
--                                                            insertBefore);
-+                *constOffset = llvm::BinaryOperator::Create(
-+                    llvm::Instruction::Add, c0, c1, ((llvm::Twine("add_") + c0->getName()) + "_") + c1->getName(),
-+                    insertBefore);
- 
-             if (v0 == NULL || llvm::isa<llvm::ConstantAggregateZero>(v0))
-                 *variableOffset = v1;
-             else if (v1 == NULL || llvm::isa<llvm::ConstantAggregateZero>(v1))
-                 *variableOffset = v0;
-             else
--                *variableOffset = llvm::BinaryOperator::Create(llvm::Instruction::Add, v0, v1,
--                                                               LLVMGetName("add", v0, v1), insertBefore);
-+                *variableOffset = llvm::BinaryOperator::Create(
-+                    llvm::Instruction::Add, v0, v1, ((llvm::Twine("add_") + v0->getName()) + "_") + v1->getName(),
-+                    insertBefore);
-             return;
-         } else if (bop->getOpcode() == llvm::Instruction::Shl) {
-             lExtractConstantOffset(op0, &c0, &v0, insertBefore);
-@@ -1633,10 +1637,12 @@ static void lExtractConstantOffset(llvm::Value *vec, llvm::Value **constOffset,
-                 *constOffset = vec;
-                 *variableOffset = NULL;
-             } else {
--                *constOffset = llvm::BinaryOperator::Create(llvm::Instruction::Shl, c0, c1, LLVMGetName("shl", c0, c1),
--                                                            insertBefore);
--                *variableOffset = llvm::BinaryOperator::Create(llvm::Instruction::Shl, v0, c1,
--                                                               LLVMGetName("shl", v0, c1), insertBefore);
-+                *constOffset = llvm::BinaryOperator::Create(
-+                    llvm::Instruction::Shl, c0, c1, ((llvm::Twine("shl_") + c0->getName()) + "_") + c1->getName(),
-+                    insertBefore);
-+                *variableOffset = llvm::BinaryOperator::Create(
-+                    llvm::Instruction::Shl, v0, c1, ((llvm::Twine("shl_") + v0->getName()) + "_") + c1->getName(),
-+                    insertBefore);
-             }
-             return;
-         } else if (bop->getOpcode() == llvm::Instruction::Mul) {
-@@ -1648,25 +1654,30 @@ static void lExtractConstantOffset(llvm::Value *vec, llvm::Value **constOffset,
-             // Note that the first term is a constant and the last three are
-             // variable.
-             if (c0 != NULL && c1 != NULL)
--                *constOffset = llvm::BinaryOperator::Create(llvm::Instruction::Mul, c0, c1, LLVMGetName("mul", c0, c1),
--                                                            insertBefore);
-+                *constOffset = llvm::BinaryOperator::Create(
-+                    llvm::Instruction::Mul, c0, c1, ((llvm::Twine("mul_") + c0->getName()) + "_") + c1->getName(),
-+                    insertBefore);
-             else
-                 *constOffset = NULL;
- 
-             llvm::Value *va = NULL, *vb = NULL, *vc = NULL;
-             if (v0 != NULL && c1 != NULL)
--                va = llvm::BinaryOperator::Create(llvm::Instruction::Mul, v0, c1, LLVMGetName("mul", v0, c1),
-+                va = llvm::BinaryOperator::Create(llvm::Instruction::Mul, v0, c1,
-+                                                  ((llvm::Twine("mul_") + v0->getName()) + "_") + c1->getName(),
-                                                   insertBefore);
-             if (c0 != NULL && v1 != NULL)
--                vb = llvm::BinaryOperator::Create(llvm::Instruction::Mul, c0, v1, LLVMGetName("mul", c0, v1),
-+                vb = llvm::BinaryOperator::Create(llvm::Instruction::Mul, c0, v1,
-+                                                  ((llvm::Twine("mul_") + c0->getName()) + "_") + v1->getName(),
-                                                   insertBefore);
-             if (v0 != NULL && v1 != NULL)
--                vc = llvm::BinaryOperator::Create(llvm::Instruction::Mul, v0, v1, LLVMGetName("mul", v0, v1),
-+                vc = llvm::BinaryOperator::Create(llvm::Instruction::Mul, v0, v1,
-+                                                  ((llvm::Twine("mul_") + v0->getName()) + "_") + v1->getName(),
-                                                   insertBefore);
- 
-             llvm::Value *vab = NULL;
-             if (va != NULL && vb != NULL)
--                vab = llvm::BinaryOperator::Create(llvm::Instruction::Add, va, vb, LLVMGetName("add", va, vb),
-+                vab = llvm::BinaryOperator::Create(llvm::Instruction::Add, va, vb,
-+                                                   ((llvm::Twine("add_") + va->getName()) + "_") + vb->getName(),
-                                                    insertBefore);
-             else if (va != NULL)
-                 vab = va;
-@@ -1674,8 +1685,9 @@ static void lExtractConstantOffset(llvm::Value *vec, llvm::Value **constOffset,
-                 vab = vb;
- 
-             if (vab != NULL && vc != NULL)
--                *variableOffset = llvm::BinaryOperator::Create(llvm::Instruction::Add, vab, vc,
--                                                               LLVMGetName("add", vab, vc), insertBefore);
-+                *variableOffset = llvm::BinaryOperator::Create(
-+                    llvm::Instruction::Add, vab, vc, ((llvm::Twine("add_") + vab->getName()) + "_") + vc->getName(),
-+                    insertBefore);
-             else if (vab != NULL)
-                 *variableOffset = vab;
-             else
-@@ -1943,7 +1955,7 @@ static bool lOffsets32BitSafe(llvm::Value **variableOffsetPtr, llvm::Value **con
-             // all zeros (i.e. a ConstantAggregateZero, but just in case,
-             // do the more general check with lVectorIs32BitInts().
-             variableOffset = new llvm::TruncInst(variableOffset, LLVMTypes::Int32VectorType,
--                                                 LLVMGetName(variableOffset, "_trunc"), insertBefore);
-+                                                 llvm::Twine(variableOffset->getName()) + "_trunc", insertBefore);
-         else
-             return false;
-     }
-@@ -1952,7 +1964,7 @@ static bool lOffsets32BitSafe(llvm::Value **variableOffsetPtr, llvm::Value **con
-         if (lVectorIs32BitInts(constOffset)) {
-             // Truncate them so we have a 32-bit vector type for them.
-             constOffset = new llvm::TruncInst(constOffset, LLVMTypes::Int32VectorType,
--                                              LLVMGetName(constOffset, "_trunc"), insertBefore);
-+                                              llvm::Twine(constOffset->getName()) + "_trunc", insertBefore);
-         } else {
-             // FIXME: otherwise we just assume that all constant offsets
-             // can actually always fit into 32-bits...  (This could be
-@@ -1963,7 +1975,7 @@ static bool lOffsets32BitSafe(llvm::Value **variableOffsetPtr, llvm::Value **con
-             // llvm::ConstantFoldInstruction() doesn't seem to be doing
-             // enough for us in some cases if we call it from here.
-             constOffset = new llvm::TruncInst(constOffset, LLVMTypes::Int32VectorType,
--                                              LLVMGetName(constOffset, "_trunc"), insertBefore);
-+                                              llvm::Twine(constOffset->getName()) + "_trunc", insertBefore);
-         }
-     }
- 
-@@ -2012,8 +2024,8 @@ static bool lOffsets32BitSafe(llvm::Value **offsetPtr, llvm::Instruction *insert
- 
-         // Alternatively, offset could be a sequence of adds terminating
-         // in safe constant vectors or a SExt.
--        *offsetPtr =
--            new llvm::TruncInst(offset, LLVMTypes::Int32VectorType, LLVMGetName(offset, "_trunc"), insertBefore);
-+        *offsetPtr = new llvm::TruncInst(offset, LLVMTypes::Int32VectorType, llvm::Twine(offset->getName()) + "_trunc",
-+                                         insertBefore);
-         return true;
-     } else
-         return false;
-@@ -2229,7 +2241,8 @@ static bool lGSToGSBaseOffsets(llvm::CallInst *callInst) {
-     }
-     // Cast the base pointer to a void *, since that's what the
-     // __pseudo_*_base_offsets_* functions want.
--    basePtr = new llvm::IntToPtrInst(basePtr, LLVMTypes::VoidPointerType, LLVMGetName(basePtr, "_2void"), callInst);
-+    basePtr = new llvm::IntToPtrInst(basePtr, LLVMTypes::VoidPointerType, llvm::Twine(basePtr->getName()) + "_2void",
-+                                     callInst);
-     lCopyMetadata(basePtr, callInst);
-     llvm::Function *gatherScatterFunc = info->baseOffsetsFunc;
- 
-@@ -2803,7 +2816,7 @@ static bool lGSToLoadStore(llvm::CallInst *callInst) {
-                 lCopyMetadata(ptr, callInst);
-                 Debug(pos, "Transformed gather to unaligned vector load!");
-                 llvm::Instruction *newCall =
--                    lCallInst(gatherInfo->loadMaskedFunc, ptr, mask, LLVMGetName(ptr, "_masked_load"));
-+                    lCallInst(gatherInfo->loadMaskedFunc, ptr, mask, llvm::Twine(ptr->getName()) + "_masked_load");
-                 lCopyMetadata(newCall, callInst);
-                 llvm::ReplaceInstWithInst(callInst, newCall);
-                 return true;
diff --git a/srcpkgs/ispc/patches/llvm12-004.patch b/srcpkgs/ispc/patches/llvm12-004.patch
deleted file mode 100644
index 3a94d8443a5e..000000000000
--- a/srcpkgs/ispc/patches/llvm12-004.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From c03a5142444476a1caa5c2ba7fa2d92d7793d6f1 Mon Sep 17 00:00:00 2001
-From: Deepak Rajendrakumaran <deepak.rajendrakumaran@intel.com>
-Date: Mon, 25 Jan 2021 09:22:49 -0800
-Subject: [PATCH] Fixing build on llvm trunk.
-
----
- src/ctx.cpp | 7 +++----
- 1 file changed, 3 insertions(+), 4 deletions(-)
-
-diff --git a/src/ctx.cpp b/src/ctx.cpp
-index ded524b71..b60e6fe84 100644
---- a/src/ctx.cpp
-+++ b/src/ctx.cpp
-@@ -1020,8 +1020,7 @@ void FunctionEmitContext::EmitCaseLabel(int value, bool checkMask, SourcePos pos
-     llvm::BasicBlock *bbCaseImpl = NULL;
-     if (emitGenXHardwareMask()) {
-         // Create basic block with actual case implementation
--        llvm::Twine bbName = llvm::Twine(bbCase->getName()) + "_impl";
--        bbCaseImpl = CreateBasicBlock(bbName, bbCase);
-+        bbCaseImpl = CreateBasicBlock(llvm::Twine(bbCase->getName()) + "_impl", bbCase);
-     }
- #endif
- 
-@@ -3142,8 +3141,8 @@ llvm::Value *FunctionEmitContext::BroadcastValue(llvm::Value *v, llvm::Type *vec
-     llvm::Value *undef2 = llvm::UndefValue::get(vecType);
- 
-     // InsertElement
--    llvm::Twine tw = name.isTriviallyEmpty() ? (llvm::Twine(v->getName()) + "_broadcast") : name + llvm::Twine("_init");
--    llvm::Value *insert = InsertInst(undef1, v, 0, tw.str().c_str());
-+    llvm::Value *insert =
-+        InsertInst(undef1, v, 0, name.isTriviallyEmpty() ? (llvm::Twine(v->getName()) + "_broadcast") : name + "_init");
- 
-     // ShuffleVector
- #if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
diff --git a/srcpkgs/ispc/patches/llvm12-005.patch b/srcpkgs/ispc/patches/llvm12-005.patch
deleted file mode 100644
index e3e96b00abfa..000000000000
--- a/srcpkgs/ispc/patches/llvm12-005.patch
+++ /dev/null
@@ -1,372 +0,0 @@
-From c1d0a51bf8416d42144de9e2bdd59825eaeff1ac Mon Sep 17 00:00:00 2001
-From: Arina Neshlyaeva <arina.neshlyaeva@intel.com>
-Date: Fri, 8 Jan 2021 14:13:49 -0800
-Subject: [PATCH] LLVM 11 support for gen code
-
----
- src/ctx.cpp                     |  13 ++-
- src/gen/GlobalsLocalization.cpp |   9 +-
- src/opt.cpp                     | 143 ++++++++++++++++++++++++--------
- 3 files changed, 124 insertions(+), 41 deletions(-)
-
-diff --git a/src/ctx.cpp b/src/ctx.cpp
-index b60e6fe84..2a72e6837 100644
---- a/src/ctx.cpp
-+++ b/src/ctx.cpp
-@@ -1,5 +1,5 @@
- /*
--  Copyright (c) 2010-2020, Intel Corporation
-+  Copyright (c) 2010-2021, Intel Corporation
-   All rights reserved.
- 
-   Redistribution and use in source and binary forms, with or without
-@@ -3685,8 +3685,17 @@ llvm::Value *FunctionEmitContext::GenXSimdCFPredicate(llvm::Value *value, llvm::
-     AssertPos(currentPos, llvm::isa<llvm::VectorType>(value->getType()));
-     llvm::VectorType *vt = llvm::dyn_cast<llvm::VectorType>(value->getType());
-     if (defaults == NULL) {
--        defaults = llvm::ConstantVector::getSplat(value->getType()->getVectorNumElements(),
-+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
-+        defaults = llvm::ConstantVector::getSplat(vt->getVectorNumElements(),
-+                                                  llvm::Constant::getNullValue(vt->getElementType()));
-+#elif ISPC_LLVM_VERSION == ISPC_LLVM_11_0
-+        defaults = llvm::ConstantVector::getSplat({static_cast<unsigned int>(vt->getNumElements()), false},
-                                                   llvm::Constant::getNullValue(vt->getElementType()));
-+#else
-+        defaults = llvm::ConstantVector::getSplat(
-+            llvm::ElementCount::get(static_cast<unsigned int>(vt->getNumElements()), false),
-+            llvm::Constant::getNullValue(vt->getElementType()));
-+#endif
-     }
- 
-     auto Fn = llvm::GenXIntrinsic::getGenXDeclaration(m->module, llvm::GenXIntrinsic::genx_simdcf_predicate,
-diff --git a/src/gen/GlobalsLocalization.cpp b/src/gen/GlobalsLocalization.cpp
-index a176e9462..41f3b00e2 100644
---- a/src/gen/GlobalsLocalization.cpp
-+++ b/src/gen/GlobalsLocalization.cpp
-@@ -1,5 +1,5 @@
- /*
--  Copyright (c) 2014, 2016-2020, Intel Corporation
-+  Copyright (c) 2014, 2016-2021, Intel Corporation
-   All rights reserved.
- 
-   Redistribution and use in source and binary forms, with or without
-@@ -53,8 +53,10 @@
- #include <llvm/GenXIntrinsics/GenXIntrOpts.h>
- #include <llvm/GenXIntrinsics/GenXIntrinsics.h>
- #include <llvm/GenXIntrinsics/GenXMetadata.h>
--#include <llvm/IR/CFG.h>
-+#if ISPC_LLVM_VERSION < ISPC_LLVM_11_0
- #include <llvm/IR/CallSite.h>
-+#endif
-+#include <llvm/IR/CFG.h>
- #include <llvm/IR/DebugInfo.h>
- #include <llvm/IR/Dominators.h>
- #include <llvm/IR/Function.h>
-@@ -470,7 +472,8 @@ void GlobalsLocalization::LocalizeGlobals(LocalizationInfo &LI) {
-         Instruction &FirstI = *Fn->getEntryBlock().begin();
-         Type *ElemTy = GV->getType()->getElementType();
-         AllocaInst *Alloca = new AllocaInst(ElemTy, 0, GV->getName() + ".local", &FirstI);
--        Alloca->setAlignment(llvm::MaybeAlign(GV->getAlignment()));
-+        Alloca->setAlignment(llvm::MaybeAlign(GV->getAlignment()).valueOrOne());
-+
-         if (!isa<UndefValue>(GV->getInitializer()))
-             new StoreInst(GV->getInitializer(), Alloca, &FirstI);
- 
-diff --git a/src/opt.cpp b/src/opt.cpp
-index d58d77f73..1789b8476 100644
---- a/src/opt.cpp
-+++ b/src/opt.cpp
-@@ -2899,15 +2899,17 @@ static llvm::Function *lGenXMaskedInt8Inst(llvm::Instruction *inst, bool isStore
- static llvm::CallInst *lGenXStoreInst(llvm::Value *val, llvm::Value *ptr, llvm::Instruction *inst) {
-     Assert(g->target->isGenXTarget());
-     Assert(llvm::isa<llvm::VectorType>(val->getType()));
--    Assert(llvm::isPowerOf2_32(val->getType()->getVectorNumElements()));
--    Assert(val->getType()->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
-+
-+    llvm::VectorType *valVecType = llvm::dyn_cast<llvm::VectorType>(val->getType());
-+    Assert(llvm::isPowerOf2_32(valVecType->getNumElements()));
-+    Assert(valVecType->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
- 
-     // The data write of svm store must have a size that is a power of two from 16 to 128
-     // bytes. However for int8 type and simd width = 8, the data write size is 8.
-     // So we use masked store function here instead of svm store which process int8 type
-     // correctly.
--    if (val->getType()->getPrimitiveSizeInBits() / 8 < 16) {
--        Assert(val->getType()->getScalarType() == LLVMTypes::Int8Type);
-+    if (valVecType->getPrimitiveSizeInBits() / 8 < 16) {
-+        Assert(valVecType->getScalarType() == LLVMTypes::Int8Type);
-         if (llvm::Function *maskedFunc = lGenXMaskedInt8Inst(inst, true))
-             return llvm::dyn_cast<llvm::CallInst>(lCallInst(maskedFunc, ptr, val, LLVMMaskAllOn, ""));
-         else {
-@@ -2923,15 +2925,17 @@ static llvm::CallInst *lGenXStoreInst(llvm::Value *val, llvm::Value *ptr, llvm::
- 
- static llvm::CallInst *lGenXLoadInst(llvm::Value *ptr, llvm::Type *retType, llvm::Instruction *inst) {
-     Assert(llvm::isa<llvm::VectorType>(retType));
--    Assert(llvm::isPowerOf2_32(retType->getVectorNumElements()));
--    Assert(retType->getPrimitiveSizeInBits());
--    Assert(retType->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
-+
-+    llvm::VectorType *retVecType = llvm::dyn_cast<llvm::VectorType>(retType);
-+    Assert(llvm::isPowerOf2_32(retVecType->getNumElements()));
-+    Assert(retVecType->getPrimitiveSizeInBits());
-+    Assert(retVecType->getPrimitiveSizeInBits() / 8 <= 8 * OWORD);
-     // The data read of svm load must have a size that is a power of two from 16 to 128
-     // bytes. However for int8 type and simd width = 8, the data read size is 8.
-     // So we use masked load function here instead of svm load which process int8 type
-     // correctly.
--    if (retType->getPrimitiveSizeInBits() / 8 < 16) {
--        Assert(retType->getScalarType() == LLVMTypes::Int8Type);
-+    if (retVecType->getPrimitiveSizeInBits() / 8 < 16) {
-+        Assert(retVecType->getScalarType() == LLVMTypes::Int8Type);
-         if (llvm::Function *maskedFunc = lGenXMaskedInt8Inst(inst, false))
-             return llvm::dyn_cast<llvm::CallInst>(lCallInst(maskedFunc, ptr, LLVMMaskAllOn, ""));
-         else {
-@@ -5622,15 +5626,24 @@ static bool lVectorizeGEPs(llvm::Value *ptr, std::vector<PtrUse> &ptrUses, std::
-         llvm::PtrToIntInst *ptrToInt =
-             new llvm::PtrToIntInst(ptr, LLVMTypes::Int64Type, "vectorized_ptrtoint", insertBefore);
-         llvm::Instruction *addr = llvm::BinaryOperator::CreateAdd(ptrToInt, offset, "vectorized_address", insertBefore);
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+        llvm::Type *retType = llvm::FixedVectorType::get(scalar_type, reqSize / t_size);
-+#else
-         llvm::Type *retType = llvm::VectorType::get(scalar_type, reqSize / t_size);
-+#endif
-         llvm::Function *fn = llvm::GenXIntrinsic::getGenXDeclaration(
-             m->module, llvm::GenXIntrinsic::genx_svm_block_ld_unaligned, {retType, addr->getType()});
-         llvm::Instruction *ld = llvm::CallInst::Create(fn, {addr}, "vectorized_ld", insertBefore);
- 
-         if (loadingPtr) {
-             // Cast int to ptr via inttoptr
-+#if ISPC_LLVM_VERSION >= ISPC_LLVM_11_0
-+            ld = new llvm::IntToPtrInst(ld, llvm::FixedVectorType::get(originalType, reqSize / t_size),
-+                                        "vectorized_inttoptr", insertBefore);
-+#else
-             ld = new llvm::IntToPtrInst(ld, llvm::VectorType::get(originalType, reqSize / t_size),
-                                         "vectorized_inttoptr", insertBefore);
-+#endif
-         }
- 
-         // Scalar extracts for all loaded elements
-@@ -6160,19 +6173,34 @@ bool ReplaceLLVMIntrinsics::runOnBasicBlock(llvm::BasicBlock &bb) {
-         llvm::Instruction *inst = &*I;
-         if (llvm::CallInst *ci = llvm::dyn_cast<llvm::CallInst>(inst)) {
-             llvm::Function *func = ci->getCalledFunction();
--            if (func && func->getName() == "llvm.trap") {
-+            if (func &&