Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package intel-graphics-compiler for 
openSUSE:Factory checked in at 2024-01-03 12:29:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/intel-graphics-compiler (Old)
 and      /work/SRC/openSUSE:Factory/.intel-graphics-compiler.new.28375 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "intel-graphics-compiler"

Wed Jan  3 12:29:26 2024 rev:7 rq:1136081 version:1.0.15136.4

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/intel-graphics-compiler/intel-graphics-compiler.changes
  2023-08-28 17:12:20.978476573 +0200
+++ 
/work/SRC/openSUSE:Factory/.intel-graphics-compiler.new.28375/intel-graphics-compiler.changes
       2024-01-03 12:30:13.442951869 +0100
@@ -1,0 +2,12 @@
+Tue Dec 19 10:20:50 UTC 2023 - Patrik Jakobsson <[email protected]>
+
+- Don't specify the specific python3 version for Mako 
+
+-------------------------------------------------------------------
+Mon Dec 18 15:08:58 UTC 2023 - Patrik Jakobsson <[email protected]>
+
+- Update to version 1.0.15136.4
+- Update opencl_clang to cf95b338d14685e4f3402ab1828bef31d48f1fd6
+- Update spirv-llvm-translator to 43baf90f96fb9df607595b63858fd9e85fbb2604
+- Update vc_intrinsics to v0.13.0
+-------------------------------------------------------------------

Old:
----
  igc-1.0.14062.11.tar.gz

New:
----
  igc-1.0.15136.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ intel-graphics-compiler.spec ++++++
--- /var/tmp/diff_new_pack.sWQXaU/_old  2024-01-03 12:30:15.259018200 +0100
+++ /var/tmp/diff_new_pack.sWQXaU/_new  2024-01-03 12:30:15.259018200 +0100
@@ -17,11 +17,11 @@
 
 
 %global llvm_commit llvmorg-14.0.5
-%global opencl_clang_commit 78c5e3f59e49f337c6a9af7818f0c8b918bee4bf
-%global spirv_llvm_translator_commit 23f398bf369093b1fd67459db8071ffcc6b92658
-%global vc_intrinsics_commit v0.12.3
+%global opencl_clang_commit cf95b338d14685e4f3402ab1828bef31d48f1fd6
+%global spirv_llvm_translator_commit 43baf90f96fb9df607595b63858fd9e85fbb2604
+%global vc_intrinsics_commit v0.13.0
 Name:           intel-graphics-compiler
-Version:        1.0.14062.11
+Version:        1.0.15136.4
 Release:        1%{?dist}
 Summary:        Intel Graphics Compiler for OpenCL
 License:        MIT
@@ -43,6 +43,7 @@
 BuildRequires:  patch
 BuildRequires:  pkgconfig
 BuildRequires:  python3
+BuildRequires:  python3-Mako
 BuildRequires:  spirv-headers
 BuildRequires:  spirv-tools-devel
 BuildRequires:  unzip

++++++ igc-1.0.14062.11.tar.gz -> igc-1.0.15136.4.tar.gz ++++++
/work/SRC/openSUSE:Factory/intel-graphics-compiler/igc-1.0.14062.11.tar.gz 
/work/SRC/openSUSE:Factory/.intel-graphics-compiler.new.28375/igc-1.0.15136.4.tar.gz
 differ: char 13, line 1

++++++ intel-opencl-clang.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/opencl-clang-78c5e3f59e49f337c6a9af7818f0c8b918bee4bf/common_clang.cpp 
new/opencl-clang-cf95b338d14685e4f3402ab1828bef31d48f1fd6/common_clang.cpp
--- old/opencl-clang-78c5e3f59e49f337c6a9af7818f0c8b918bee4bf/common_clang.cpp  
2023-05-16 07:08:49.000000000 +0200
+++ new/opencl-clang-cf95b338d14685e4f3402ab1828bef31d48f1fd6/common_clang.cpp  
2023-06-12 10:16:31.000000000 +0200
@@ -85,7 +85,7 @@
     true; // the flag must be 'volatile' to prevent caching in a CPU register
 static llvm::sys::Mutex lazyCCInitMutex;
 
-static llvm::ManagedStatic<llvm::sys::SmartMutex<true> > compileMutex;
+llvm::ManagedStatic<llvm::sys::SmartMutex<true>> compileMutex;
 
 void CommonClangTerminate() { llvm::llvm_shutdown(); }
 
@@ -212,6 +212,9 @@
   CommonClangInitialize();
 
   try {
+#ifdef _WIN32
+    llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
+#endif
     std::unique_ptr<OCLFEBinaryResult> pResult(new OCLFEBinaryResult());
 
     // Create the clang compiler
@@ -223,8 +226,9 @@
     // Prepare error log
     llvm::raw_string_ostream err_ostream(pResult->getLogRef());
     {
-      llvm::sys::SmartScopedLock<true> compileGuard {*compileMutex};
-
+#ifndef _WIN32
+      llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
+#endif
       // Parse options
       optionsParser.processOptions(pszOptions, pszOptionsEx);
 
@@ -343,7 +347,9 @@
       err_ostream.flush();
     }
     {
-      llvm::sys::SmartScopedLock<true> compileGuard {*compileMutex};
+#ifndef _WIN32
+      llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
+#endif
       if (pBinaryResult) {
         *pBinaryResult = pResult.release();
       }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/opencl-clang-78c5e3f59e49f337c6a9af7818f0c8b918bee4bf/options_compile.cpp 
new/opencl-clang-cf95b338d14685e4f3402ab1828bef31d48f1fd6/options_compile.cpp
--- 
old/opencl-clang-78c5e3f59e49f337c6a9af7818f0c8b918bee4bf/options_compile.cpp   
    2023-05-16 07:08:49.000000000 +0200
+++ 
new/opencl-clang-cf95b338d14685e4f3402ab1828bef31d48f1fd6/options_compile.cpp   
    2023-06-12 10:16:31.000000000 +0200
@@ -39,7 +39,7 @@
 
 using namespace llvm::opt;
 
-static llvm::ManagedStatic<llvm::sys::SmartMutex<true> > compileOptionsMutex;
+extern llvm::ManagedStatic<llvm::sys::SmartMutex<true>> compileMutex;
 
 static const OptTable::Info ClangOptionsInfoTable[] = {
 #define PREFIX(NAME, VALUE)
@@ -430,7 +430,7 @@
                                                   size_t uiUnknownOptionsSize) 
{
   // LLVM doesn't guarantee thread safety,
   // therefore we serialize execution of LLVM code.
-  llvm::sys::SmartScopedLock<true> compileOptionsGuard {*compileOptionsMutex};
+  llvm::sys::SmartScopedLock<true> compileOptionsGuard{*compileMutex};
 
   try {
     CompileOptionsParser optionsParser("200");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/opencl-clang-78c5e3f59e49f337c6a9af7818f0c8b918bee4bf/patches/clang/0006-Make-globals-used-for-array-initialization-codegen-c.patch
 
new/opencl-clang-cf95b338d14685e4f3402ab1828bef31d48f1fd6/patches/clang/0006-Make-globals-used-for-array-initialization-codegen-c.patch
--- 
old/opencl-clang-78c5e3f59e49f337c6a9af7818f0c8b918bee4bf/patches/clang/0006-Make-globals-used-for-array-initialization-codegen-c.patch
     1970-01-01 01:00:00.000000000 +0100
+++ 
new/opencl-clang-cf95b338d14685e4f3402ab1828bef31d48f1fd6/patches/clang/0006-Make-globals-used-for-array-initialization-codegen-c.patch
     2023-06-12 10:16:31.000000000 +0200
@@ -0,0 +1,268 @@
+From e9e2434697c3a28f151ce179dd88f0ba73f0f0a0 Mon Sep 17 00:00:00 2001
+From: Haonan Yang <[email protected]>
+Date: Tue, 30 May 2023 09:37:00 +0800
+Subject: [PATCH] Make globals used for array initialization codegen constant
+
+This combines https://reviews.llvm.org/D146211 and 
https://reviews.llvm.org/D145369
+1. Emit const globals with constexpr destructor as constant LLVM values
+This follows 2b4fa53 which made Clang not emit destructor calls for such
+objects. However, they would still not get emitted as constants since
+CodeGenModule::isTypeConstant() returns false if the destructor is
+constexpr. This change adds a param to make isTypeConstant() ignore the
+dtor, allowing the caller to check it instead.
+2. Make globals used for array initialization codegen constant
+As pointed out in D133835 these globals will never be written to
+(they're only used for trivially copyable types), so they can always be
+constant.
+---
+ clang/lib/CodeGen/CGDecl.cpp                    | 12 ++++++++----
+ clang/lib/CodeGen/CGDeclCXX.cpp                 |  4 +++-
+ clang/lib/CodeGen/CGExpr.cpp                    |  2 +-
+ clang/lib/CodeGen/CGExprAgg.cpp                 |  4 ++--
+ clang/lib/CodeGen/CGExprConstant.cpp            | 12 ++++++------
+ clang/lib/CodeGen/CodeGenModule.cpp             | 16 +++++++++-------
+ clang/lib/CodeGen/CodeGenModule.h               |  2 +-
+ clang/lib/CodeGen/TargetInfo.cpp                |  2 +-
+ clang/test/CodeGen/init.c                       |  2 +-
+ clang/test/CodeGen/label-array-aggregate-init.c |  2 +-
+ clang/test/CodeGenCXX/const-init-cxx2a.cpp      |  4 ++--
+ 11 files changed, 35 insertions(+), 27 deletions(-)
+
+diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
+index 18d658436086..372f392402cf 100644
+--- a/clang/lib/CodeGen/CGDecl.cpp
++++ b/clang/lib/CodeGen/CGDecl.cpp
+@@ -379,13 +379,15 @@ CodeGenFunction::AddInitializerToStaticVarDecl(const 
VarDecl &D,
+     OldGV->eraseFromParent();
+   }
+ 
+-  GV->setConstant(CGM.isTypeConstant(D.getType(), true));
++  bool NeedsDtor =
++      D.needsDestruction(getContext()) == QualType::DK_cxx_destructor;
++
++  GV->setConstant(CGM.isTypeConstant(D.getType(), true, !NeedsDtor));
+   GV->setInitializer(Init);
+ 
+   emitter.finalize(GV);
+ 
+-  if (D.needsDestruction(getContext()) == QualType::DK_cxx_destructor &&
+-      HaveInsertPoint()) {
++  if (NeedsDtor && HaveInsertPoint()) {
+     // We have a constant initializer, but a nontrivial destructor. We still
+     // need to perform a guarded "initialization" in order to register the
+     // destructor.
+@@ -1470,10 +1472,12 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) {
+       // emit it as a global instead.
+       // Exception is if a variable is located in non-constant address space
+       // in OpenCL.
++      bool NeedsDtor =
++          D.needsDestruction(getContext()) == QualType::DK_cxx_destructor;
+       if ((!getLangOpts().OpenCL ||
+            Ty.getAddressSpace() == LangAS::opencl_constant) &&
+           (CGM.getCodeGenOpts().MergeAllConstants && !NRVO &&
+-           !isEscapingByRef && CGM.isTypeConstant(Ty, true))) {
++          !isEscapingByRef && CGM.isTypeConstant(Ty, true, !NeedsDtor))) {
+         EmitStaticVarDecl(D, llvm::GlobalValue::InternalLinkage);
+ 
+         // Signal this condition to later callbacks.
+diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
+index 7b880c1354e1..3dfffdbed8eb 100644
+--- a/clang/lib/CodeGen/CGDeclCXX.cpp
++++ b/clang/lib/CodeGen/CGDeclCXX.cpp
+@@ -213,9 +213,11 @@ void CodeGenFunction::EmitCXXGlobalVarDeclInit(const 
VarDecl &D,
+           &D, DeclAddr, D.getAttr<OMPThreadPrivateDeclAttr>()->getLocation(),
+           PerformInit, this);
+     }
++    bool NeedsDtor =
++        D.needsDestruction(getContext()) == QualType::DK_cxx_destructor;
+     if (PerformInit)
+       EmitDeclInit(*this, D, DeclAddr);
+-    if (CGM.isTypeConstant(D.getType(), true))
++    if (CGM.isTypeConstant(D.getType(), true, !NeedsDtor))
+       EmitDeclInvariant(*this, D, DeclPtr);
+     else
+       EmitDeclDestroy(*this, D, DeclAddr);
+diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
+index 2a9b108c31bc..86ed8b1892ea 100644
+--- a/clang/lib/CodeGen/CGExpr.cpp
++++ b/clang/lib/CodeGen/CGExpr.cpp
+@@ -390,7 +390,7 @@ static Address createReferenceTemporary(CodeGenFunction 
&CGF,
+     QualType Ty = Inner->getType();
+     if (CGF.CGM.getCodeGenOpts().MergeAllConstants &&
+         (Ty->isArrayType() || Ty->isRecordType()) &&
+-        CGF.CGM.isTypeConstant(Ty, true))
++        CGF.CGM.isTypeConstant(Ty, true, false))
+       if (auto Init = ConstantEmitter(CGF).tryEmitAbstract(Inner, Ty)) {
+         auto AS = CGF.CGM.GetGlobalConstantAddressSpace();
+         auto *GV = new llvm::GlobalVariable(
+diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
+index 73b05690537d..4f5b5b4cdef3 100644
+--- a/clang/lib/CodeGen/CGExprAgg.cpp
++++ b/clang/lib/CodeGen/CGExprAgg.cpp
+@@ -506,8 +506,8 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr, 
llvm::ArrayType *AType,
+     if (llvm::Constant *C = Emitter.tryEmitForInitializer(E, AS, ArrayQTy)) {
+       auto GV = new llvm::GlobalVariable(
+           CGM.getModule(), C->getType(),
+-          CGM.isTypeConstant(ArrayQTy, /* ExcludeCtorDtor= */ true),
+-          llvm::GlobalValue::PrivateLinkage, C, "constinit",
++          /* isConstant= */ true, llvm::GlobalValue::PrivateLinkage, C,
++          "constinit",
+           /* InsertBefore= */ nullptr, llvm::GlobalVariable::NotThreadLocal,
+           CGM.getContext().getTargetAddressSpace(AS));
+       Emitter.finalize(GV);
+diff --git a/clang/lib/CodeGen/CGExprConstant.cpp 
b/clang/lib/CodeGen/CGExprConstant.cpp
+index ac4b4d1308ab..64129b64e272 100644
+--- a/clang/lib/CodeGen/CGExprConstant.cpp
++++ b/clang/lib/CodeGen/CGExprConstant.cpp
+@@ -913,12 +913,12 @@ static ConstantAddress 
tryEmitGlobalCompoundLiteral(CodeGenModule &CGM,
+     return ConstantAddress::invalid();
+   }
+ 
+-  auto GV = new llvm::GlobalVariable(CGM.getModule(), C->getType(),
+-                                     CGM.isTypeConstant(E->getType(), true),
+-                                     llvm::GlobalValue::InternalLinkage,
+-                                     C, ".compoundliteral", nullptr,
+-                                     llvm::GlobalVariable::NotThreadLocal,
+-                    CGM.getContext().getTargetAddressSpace(addressSpace));
++  auto GV = new llvm::GlobalVariable(
++      CGM.getModule(), C->getType(),
++      CGM.isTypeConstant(E->getType(), true, false),
++      llvm::GlobalValue::InternalLinkage, C, ".compoundliteral", nullptr,
++      llvm::GlobalVariable::NotThreadLocal,
++      CGM.getContext().getTargetAddressSpace(addressSpace));
+   emitter.finalize(GV);
+   GV->setAlignment(Align.getAsAlign());
+   CGM.setAddrOfConstantCompoundLiteral(E, GV);
+diff --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
+index 2777fc22600d..c88228090c17 100644
+--- a/clang/lib/CodeGen/CodeGenModule.cpp
++++ b/clang/lib/CodeGen/CodeGenModule.cpp
+@@ -2826,7 +2826,7 @@ bool CodeGenModule::MayBeEmittedEagerly(const ValueDecl 
*Global) {
+   // codegen for global variables, because they may be marked as 
threadprivate.
+   if (LangOpts.OpenMP && LangOpts.OpenMPUseTLS &&
+       getContext().getTargetInfo().isTLSSupported() && isa<VarDecl>(Global) &&
+-      !isTypeConstant(Global->getType(), false) &&
++      !isTypeConstant(Global->getType(), false, false) &&
+       !OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(Global))
+     return false;
+ 
+@@ -3988,8 +3988,9 @@ CodeGenModule::CreateRuntimeFunction(llvm::FunctionType 
*FTy, StringRef Name,
+ ///
+ /// If ExcludeCtor is true, the duration when the object's constructor runs
+ /// will not be considered. The caller will need to verify that the object is
+-/// not written to during its construction.
+-bool CodeGenModule::isTypeConstant(QualType Ty, bool ExcludeCtor) {
++/// not written to during its construction. ExcludeDtor works similarly.
++bool CodeGenModule::isTypeConstant(QualType Ty, bool ExcludeCtor,
++                                   bool ExcludeDtor) {
+   if (!Ty.isConstant(Context) && !Ty->isReferenceType())
+     return false;
+ 
+@@ -3997,7 +3998,7 @@ bool CodeGenModule::isTypeConstant(QualType Ty, bool 
ExcludeCtor) {
+     if (const CXXRecordDecl *Record
+           = Context.getBaseElementType(Ty)->getAsCXXRecordDecl())
+       return ExcludeCtor && !Record->hasMutableFields() &&
+-             Record->hasTrivialDestructor();
++             (Record->hasTrivialDestructor() || ExcludeDtor);
+   }
+ 
+   return true;
+@@ -4108,7 +4109,7 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef 
MangledName, llvm::Type *Ty,
+ 
+     // FIXME: This code is overly simple and should be merged with other 
global
+     // handling.
+-    GV->setConstant(isTypeConstant(D->getType(), false));
++    GV->setConstant(isTypeConstant(D->getType(), false, false));
+ 
+     GV->setAlignment(getContext().getDeclAlign(D).getAsAlign());
+ 
+@@ -4642,7 +4643,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const 
VarDecl *D,
+ 
+   // If it is safe to mark the global 'constant', do so now.
+   GV->setConstant(!NeedsGlobalCtor && !NeedsGlobalDtor &&
+-                  isTypeConstant(D->getType(), true));
++                  isTypeConstant(D->getType(), true, true));
+ 
+   // If it is in a read-only section, mark it 'constant'.
+   if (const SectionAttr *SA = D->getAttr<SectionAttr>()) {
+@@ -5703,7 +5704,8 @@ ConstantAddress CodeGenModule::GetAddrOfGlobalTemporary(
+     emitter.emplace(*this);
+     InitialValue = emitter->emitForInitializer(*Value, AddrSpace,
+                                                MaterializedType);
+-    Constant = isTypeConstant(MaterializedType, /*ExcludeCtor*/Value);
++    Constant = isTypeConstant(MaterializedType, /*ExcludeCtor*/ Value,
++                              /*ExcludeDtor*/ false);
+     Type = InitialValue->getType();
+   } else {
+     // No initializer, the initialization will be provided when we
+diff --git a/clang/lib/CodeGen/CodeGenModule.h 
b/clang/lib/CodeGen/CodeGenModule.h
+index a8a63c8da57f..28ea927c448d 100644
+--- a/clang/lib/CodeGen/CodeGenModule.h
++++ b/clang/lib/CodeGen/CodeGenModule.h
+@@ -765,7 +765,7 @@ public:
+     return getTBAAAccessInfo(AccessType);
+   }
+ 
+-  bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor);
++  bool isTypeConstant(QualType QTy, bool ExcludeCtor, bool ExcludeDtor);
+ 
+   bool isPaddedAtomicType(QualType type);
+   bool isPaddedAtomicType(const AtomicType *type);
+diff --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
+index d83bc9e529a6..672ca38c6803 100644
+--- a/clang/lib/CodeGen/TargetInfo.cpp
++++ b/clang/lib/CodeGen/TargetInfo.cpp
+@@ -9440,7 +9440,7 @@ 
AMDGPUTargetCodeGenInfo::getGlobalVarAddressSpace(CodeGenModule &CGM,
+     return AddrSpace;
+ 
+   // Only promote to address space 4 if VarDecl has constant initialization.
+-  if (CGM.isTypeConstant(D->getType(), false) &&
++  if (CGM.isTypeConstant(D->getType(), false, false) &&
+       D->hasConstantInitialization()) {
+     if (auto ConstAS = CGM.getTarget().getConstantAddressSpace())
+       return ConstAS.getValue();
+diff --git a/clang/test/CodeGen/init.c b/clang/test/CodeGen/init.c
+index a21b5f4c09f5..93859924349b 100644
+--- a/clang/test/CodeGen/init.c
++++ b/clang/test/CodeGen/init.c
+@@ -10,7 +10,7 @@ unsigned v2[2][3] = {[0 ... 1][0 ... 1] = 2222, 3333};
+ 
+ // CHECK-DAG: [1 x %struct.M] [%struct.M { [2 x %struct.I] [%struct.I { [3 x 
i32] [i32 4, i32 4, i32 0] }, %struct.I { [3 x i32] [i32 4, i32 4, i32 5] }] }],
+ // CHECK-DAG: [2 x [3 x i32]] {{[[][[]}}3 x i32] [i32 2222, i32 2222, i32 0], 
[3 x i32] [i32 2222, i32 2222, i32 3333]],
+-// CHECK-DAG: [[INIT14:.*]] = private global [16 x i32] [i32 0, i32 0, i32 0, 
i32 0, i32 0, i32 17, i32 17, i32 17, i32 17, i32 17, i32 17, i32 17, i32 0, 
i32 0, i32 0, i32 0], align 4
++// CHECK-DAG: [[INIT14:.*]] = private constant [16 x i32] [i32 0, i32 0, i32 
0, i32 0, i32 0, i32 17, i32 17, i32 17, i32 17, i32 17, i32 17, i32 17, i32 0, 
i32 0, i32 0, i32 0], align 4
+ 
+ void f1() {
+   // Scalars in braces.
+diff --git a/clang/test/CodeGen/label-array-aggregate-init.c 
b/clang/test/CodeGen/label-array-aggregate-init.c
+index 5cefd8d270c0..3175c2a6a292 100644
+--- a/clang/test/CodeGen/label-array-aggregate-init.c
++++ b/clang/test/CodeGen/label-array-aggregate-init.c
+@@ -1,6 +1,6 @@
+ // RUN: %clang -cc1 -triple x86_64-windows-msvc -emit-llvm %s -o - | 
FileCheck %s
+ 
+-// CHECK: @constinit = private global [3 x i8*] [i8* blockaddress(@main, %L), 
i8* null, i8* null]
++// CHECK: @constinit = private constant [3 x i8*] [i8* blockaddress(@main, 
%L), i8* null, i8* null]
+ 
+ void receivePtrs(void **);
+ 
+diff --git a/clang/test/CodeGenCXX/const-init-cxx2a.cpp 
b/clang/test/CodeGenCXX/const-init-cxx2a.cpp
+index 3eafef094387..3c83a9c94ade 100644
+--- a/clang/test/CodeGenCXX/const-init-cxx2a.cpp
++++ b/clang/test/CodeGenCXX/const-init-cxx2a.cpp
+@@ -11,10 +11,10 @@ struct B {
+   constexpr ~B() { n *= 5; }
+   int n = 123;
+ };
+-// CHECK: @b ={{.*}} global {{.*}} i32 123
++// CHECK: @b ={{.*}} constant {{.*}} i32 123
+ extern constexpr B b = B();
+ 
+-// CHECK: @_ZL1c = internal global {{.*}} i32 123
++// CHECK: @_ZL1c = internal constant {{.*}} i32 123
+ const B c;
+ int use_c() { return c.n; }
+ 
+-- 
+2.31.1
+

++++++ spirv-llvm-translator.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/LLVMToSPIRVDbgTran.cpp
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/LLVMToSPIRVDbgTran.cpp
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/LLVMToSPIRVDbgTran.cpp
 2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/LLVMToSPIRVDbgTran.cpp
 2023-08-04 18:33:36.000000000 +0200
@@ -772,7 +772,7 @@
 
 SPIRVEntry *LLVMToSPIRVDbgTran::transDbgSubrangeType(const DISubrange *ST) {
   using namespace SPIRVDebug::Operand::TypeSubrange;
-  SPIRVWordVec Ops(OperandCount);
+  SPIRVWordVec Ops(MinOperandCount);
   auto TransOperand = [&Ops, this, ST](int Idx) -> void {
     Metadata *RawNode = nullptr;
     switch (Idx) {
@@ -785,9 +785,6 @@
     case CountIdx:
       RawNode = ST->getRawCountNode();
       break;
-    case StrideIdx:
-      RawNode = ST->getRawStride();
-      break;
     }
     if (!RawNode) {
       Ops[Idx] = getDebugInfoNoneId();
@@ -815,8 +812,17 @@
                          : getDebugInfoNoneId();
     }
   };
-  for (int Idx = CountIdx; Idx < OperandCount; ++Idx)
+  for (int Idx = 0; Idx < MinOperandCount; ++Idx)
     TransOperand(Idx);
+  if (auto *RawNode = ST->getRawStride()) {
+    Ops.resize(MaxOperandCount);
+    if (auto *Node = dyn_cast<MDNode>(RawNode))
+      Ops[StrideIdx] = transDbgEntry(Node)->getId();
+    else
+      Ops[StrideIdx] =
+          SPIRVWriter->transValue(ST->getStride().get<ConstantInt *>(), 
nullptr)
+              ->getId();
+  }
   return BM->addDebugInfo(SPIRVDebug::TypeSubrange, getVoidTy(), Ops);
 }
 
@@ -1599,20 +1605,19 @@
   auto Tag = static_cast<dwarf::Tag>(IE->getTag());
   // FIXME: 'OpenCL/bugged' version is kept because it's hard to remove it
   // It's W/A for missing 2nd index in OpenCL's implementation
-  const SPIRVWord OffsetIdx =
-      isNonSemanticDebugInfo() ? OperandCount - NonSemantic::OperandCount : 0;
-  SPIRVWordVec Ops(OperandCount - OffsetIdx);
-  Ops[NameIdx] = BM->getString(IE->getName().str())->getId();
-  Ops[TagIdx] = SPIRV::DbgImportedEntityMap::map(Tag);
-  Ops[SourceIdx - OffsetIdx] = getSource(IE->getFile())->getId();
-  Ops[EntityIdx - OffsetIdx] = transDbgEntry(IE->getEntity())->getId();
-  Ops[LineIdx - OffsetIdx] = IE->getLine();
+  const SPIRVWord OffsetIdx = static_cast<int>(isNonSemanticDebugInfo());
+  SPIRVWordVec Ops(OpenCL::OperandCount - OffsetIdx);
+  Ops[OpenCL::NameIdx] = BM->getString(IE->getName().str())->getId();
+  Ops[OpenCL::TagIdx] = SPIRV::DbgImportedEntityMap::map(Tag);
+  Ops[OpenCL::SourceIdx - OffsetIdx] = getSource(IE->getFile())->getId();
+  Ops[OpenCL::EntityIdx - OffsetIdx] = transDbgEntry(IE->getEntity())->getId();
+  Ops[OpenCL::LineIdx - OffsetIdx] = IE->getLine();
   // This version of DIImportedEntity has no column number
-  Ops[ColumnIdx - OffsetIdx] = 0;
-  Ops[ParentIdx - OffsetIdx] = getScope(IE->getScope())->getId();
+  Ops[OpenCL::ColumnIdx - OffsetIdx] = 0;
+  Ops[OpenCL::ParentIdx - OffsetIdx] = getScope(IE->getScope())->getId();
   if (isNonSemanticDebugInfo())
-    transformToConstant(Ops,
-                        {TagIdx, LineIdx - OffsetIdx, ColumnIdx - OffsetIdx});
+    transformToConstant(Ops, {OpenCL::TagIdx, OpenCL::LineIdx - OffsetIdx,
+                              OpenCL::ColumnIdx - OffsetIdx});
   return BM->addDebugInfo(SPIRVDebug::ImportedEntity, getVoidTy(), Ops);
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/OCLToSPIRV.cpp
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/OCLToSPIRV.cpp
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/OCLToSPIRV.cpp
 2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/OCLToSPIRV.cpp
 2023-08-04 18:33:36.000000000 +0200
@@ -159,12 +159,8 @@
 
   visit(*M);
 
-  for (auto &I : ValuesToDelete)
-    if (auto Inst = dyn_cast<Instruction>(I))
-      Inst->eraseFromParent();
-  for (auto &I : ValuesToDelete)
-    if (auto GV = dyn_cast<GlobalValue>(I))
-      GV->eraseFromParent();
+  for (Instruction *I : ValuesToDelete)
+    I->eraseFromParent();
 
   eraseUselessFunctions(M); // remove unused functions declarations
   LLVM_DEBUG(dbgs() << "After OCLToSPIRV:\n" << *M);
@@ -1135,7 +1131,6 @@
                     << *CI->getArgOperand(0) << '\n');
     CI->replaceAllUsesWith(CI->getArgOperand(0));
     ValuesToDelete.insert(CI);
-    ValuesToDelete.insert(CI->getCalledFunction());
     return true;
   }
   return false;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/OCLToSPIRV.h
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/OCLToSPIRV.h
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/OCLToSPIRV.h
   2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/OCLToSPIRV.h
   2023-08-04 18:33:36.000000000 +0200
@@ -267,7 +267,7 @@
   Module *M;
   LLVMContext *Ctx;
   unsigned CLVer; /// OpenCL version as major*10+minor
-  std::set<Value *> ValuesToDelete;
+  std::set<Instruction *> ValuesToDelete;
   OCLTypeToSPIRVBase *OCLTypeToSPIRVPtr;
 
   ConstantInt *addInt32(int I) { return getInt32(M, I); }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/SPIRVInternal.h
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/SPIRVInternal.h
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/SPIRVInternal.h
        2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/SPIRVInternal.h
        2023-08-04 18:33:36.000000000 +0200
@@ -1080,7 +1080,7 @@
                                 SmallVectorImpl<std::string> &Strs);
 
 // Copy attributes from function to call site.
-void setAttrByCalledFunc(CallInst *Call);
+CallInst *setAttrByCalledFunc(CallInst *Call);
 bool isSPIRVBuiltinVariable(GlobalVariable *GV, SPIRVBuiltinVariableKind 
*Kind);
 // Transform builtin variable from GlobalVariable to builtin call.
 // e.g.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
 2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
 2023-08-04 18:33:36.000000000 +0200
@@ -173,6 +173,34 @@
   return transDebugInst<DIScope>(static_cast<const SPIRVExtInst *>(ScopeInst));
 }
 
+void SPIRVToLLVMDbgTran::appendToSourceLangLiteral(DICompileUnit *CompileUnit,
+                                                   SPIRVWord SourceLang) {
+  if (!M->getModuleFlag("Source Lang Literal")) {
+    M->addModuleFlag(llvm::Module::Warning, "Source Lang Literal",
+                     MDTuple::get(M->getContext(), {}));
+  }
+  auto *SourceLangLiteral =
+      dyn_cast<MDTuple>(M->getModuleFlag("Source Lang Literal"));
+
+  // Copy old content
+  SmallVector<Metadata *, 4> Nodes;
+  for (auto &Node : SourceLangLiteral->operands()) {
+    Nodes.push_back(Node);
+  }
+
+  // Add new entry
+  Nodes.push_back(MDTuple::get(
+      M->getContext(), SmallVector<Metadata *, 2>{
+                           CompileUnit,
+                           ConstantAsMetadata::get(ConstantInt::get(
+                               Type::getInt32Ty(M->getContext()), SourceLang)),
+                       }));
+
+  // Update
+  M->setModuleFlag(llvm::Module::Warning, "Source Lang Literal",
+                   MDTuple::get(M->getContext(), Nodes));
+}
+
 DICompileUnit *
 SPIRVToLLVMDbgTran::transCompilationUnit(const SPIRVExtInst *DebugInst,
                                          const std::string CompilerVersion,
@@ -180,7 +208,7 @@
   // Do nothing in case we have already translated the CU (e.g. during
   // DebugEntryPoint translation)
   if (BuilderMap[DebugInst->getId()])
-    return nullptr;
+    return cast<DICompileUnit>(DebugInstCache[DebugInst]);
 
   const SPIRVWordVec &Ops = DebugInst->getArguments();
 
@@ -197,6 +225,8 @@
   }
   SPIRVWord SourceLang =
       getConstantValueOrLiteral(Ops, LanguageIdx, DebugInst->getExtSetKind());
+  SPIRVWord OriginalSourceLang = SourceLang;
+  bool InvalidSourceLang = false;
   if (DebugInst->getExtSetKind() == SPIRVEIS_NonSemantic_Shader_DebugInfo_200) 
{
     SourceLang = convertSPIRVSourceLangToDWARFNonSemanticDbgInfo(SourceLang);
   } else if (isSPIRVSourceLangValid(SourceLang)) {
@@ -205,8 +235,8 @@
     // Some SPIR-V producers generate invalid source language value. In such
     // case the original value should be preserved in "Source Lang Literal"
     // module flag for later use by LLVM IR consumers.
-    M->addModuleFlag(llvm::Module::Warning, "Source Lang Literal", SourceLang);
     SourceLang = dwarf::DW_LANG_OpenCL;
+    InvalidSourceLang = true;
   }
 
   BuilderMap[DebugInst->getId()] = std::make_unique<DIBuilder>(*M);
@@ -224,20 +254,28 @@
            DebugInst->getExtSetKind() ==
                SPIRVEIS_NonSemantic_Shader_DebugInfo_200);
 
-    return BuilderMap[DebugInst->getId()]->createCompileUnit(
+    auto *CompileUnit = BuilderMap[DebugInst->getId()]->createCompileUnit(
         SourceLang, getFile(Ops[SourceIdx]),
         DebugInst->getExtSetKind() == SPIRVEIS_NonSemantic_Shader_DebugInfo_100
             ? CompilerVersion
             : getString(Ops[ProducerIdx]),
         false, Flags, 0, StoragePath,
         DICompileUnit::DebugEmissionKind::FullDebug, BuildIdentifier);
+    if (InvalidSourceLang) {
+      appendToSourceLangLiteral(CompileUnit, OriginalSourceLang);
+    }
+    return CompileUnit;
   }
 
   // TODO: Remove this workaround once we switch to NonSemantic.Shader.* debug
   // info by default
   auto Producer = findModuleProducer();
-  return BuilderMap[DebugInst->getId()]->createCompileUnit(
+  auto *CompileUnit = BuilderMap[DebugInst->getId()]->createCompileUnit(
       SourceLang, getFile(Ops[SourceIdx]), Producer, false, Flags, 0);
+  if (InvalidSourceLang) {
+    appendToSourceLangLiteral(CompileUnit, OriginalSourceLang);
+  }
+  return CompileUnit;
 }
 
 DIBasicType *SPIRVToLLVMDbgTran::transTypeBasic(const SPIRVExtInst *DebugInst) 
{
@@ -562,8 +600,9 @@
 SPIRVToLLVMDbgTran::transTypeSubrange(const SPIRVExtInst *DebugInst) {
   using namespace SPIRVDebug::Operand::TypeSubrange;
   const SPIRVWordVec &Ops = DebugInst->getArguments();
-  assert(Ops.size() == OperandCount && "Invalid number of operands");
-  std::vector<Metadata *> TranslatedOps(OperandCount, nullptr);
+  assert((Ops.size() == MinOperandCount || Ops.size() == MaxOperandCount) &&
+         "Invalid number of operands");
+  std::vector<Metadata *> TranslatedOps(MaxOperandCount, nullptr);
   auto TransOperand = [&Ops, &TranslatedOps, this](int Idx) -> void {
     if (!getDbgInst<SPIRVDebug::DebugInfoNone>(Ops[Idx])) {
       if (auto *GlobalVar = getDbgInst<SPIRVDebug::GlobalVariable>(Ops[Idx])) {
@@ -582,10 +621,11 @@
       }
     }
   };
-  for (int Idx = CountIdx; Idx < OperandCount; ++Idx)
+  for (size_t Idx = 0; Idx < Ops.size(); ++Idx)
     TransOperand(Idx);
   return getDIBuilder(DebugInst).getOrCreateSubrange(
-      TranslatedOps[0], TranslatedOps[1], TranslatedOps[2], TranslatedOps[3]);
+      TranslatedOps[CountIdx], TranslatedOps[LowerBoundIdx],
+      TranslatedOps[UpperBoundIdx], TranslatedOps[StrideIdx]);
 }
 
 DIStringType *
@@ -1058,8 +1098,8 @@
   std::string Producer = getString(Ops[CompilerSignatureIdx]);
   std::string CLArgs = getString(Ops[CommandLineArgsIdx]);
 
-  [[maybe_unused]] DICompileUnit *C =
-      transCompilationUnit(CU, Producer, CLArgs);
+  DICompileUnit *C = transCompilationUnit(CU, Producer, CLArgs); // NOLINT
+  DebugInstCache[CU] = C;
 
   return transFunction(EP, true /*IsMainSubprogram*/);
 }
@@ -1269,20 +1309,19 @@
   const SPIRVWordVec &Ops = DebugInst->getArguments();
   // FIXME: 'OpenCL/bugged' version is kept because it's hard to remove it
   // It's W/A for missing 2nd index in OpenCL's implementation
-  const SPIRVWord OffsetIdx = 
isNonSemanticDebugInfo(DebugInst->getExtSetKind())
-                                  ? OperandCount - NonSemantic::OperandCount
-                                  : 0;
+  const SPIRVWord OffsetIdx =
+      static_cast<int>(isNonSemanticDebugInfo(DebugInst->getExtSetKind()));
 
-  assert(Ops.size() == (OperandCount - OffsetIdx) &&
+  assert(Ops.size() == (OpenCL::OperandCount - OffsetIdx) &&
          "Invalid number of operands");
-  DIScope *Scope = getScope(BM->getEntry(Ops[ParentIdx - OffsetIdx]));
-  SPIRVWord Line = getConstantValueOrLiteral(Ops, LineIdx - OffsetIdx,
+  DIScope *Scope = getScope(BM->getEntry(Ops[OpenCL::ParentIdx - OffsetIdx]));
+  SPIRVWord Line = getConstantValueOrLiteral(Ops, OpenCL::LineIdx - OffsetIdx,
                                              DebugInst->getExtSetKind());
-  DIFile *File = getFile(Ops[SourceIdx - OffsetIdx]);
-  auto *Entity =
-      transDebugInst<DINode>(BM->get<SPIRVExtInst>(Ops[EntityIdx - 
OffsetIdx]));
-  SPIRVWord Tag =
-      getConstantValueOrLiteral(Ops, TagIdx, DebugInst->getExtSetKind());
+  DIFile *File = getFile(Ops[OpenCL::SourceIdx - OffsetIdx]);
+  auto *Entity = transDebugInst<DINode>(
+      BM->get<SPIRVExtInst>(Ops[OpenCL::EntityIdx - OffsetIdx]));
+  SPIRVWord Tag = getConstantValueOrLiteral(Ops, OpenCL::TagIdx,
+                                            DebugInst->getExtSetKind());
   if (Tag == SPIRVDebug::ImportedModule) {
     if (!Entity)
       return getDIBuilder(DebugInst).createImportedModule(
@@ -1298,7 +1337,7 @@
                                                           Line);
   }
   if (Tag == SPIRVDebug::ImportedDeclaration) {
-    StringRef Name = getString(Ops[NameIdx]);
+    StringRef Name = getString(Ops[OpenCL::NameIdx]);
     if (DIGlobalVariableExpression *GVE =
             dyn_cast<DIGlobalVariableExpression>(Entity))
       return getDIBuilder(DebugInst).createImportedDeclaration(
@@ -1314,15 +1353,21 @@
   const SPIRVWordVec &Ops = DebugInst->getArguments();
   assert(Ops.size() >= OperandCount && "Invalid number of operands");
   DIScope *Scope = getScope(BM->getEntry(Ops[ParentIdx]));
-  SPIRVWord Line =
-      getConstantValueOrLiteral(Ops, LineIdx, DebugInst->getExtSetKind());
+  // In case we translate DebugModuleINTEL instruction (not DebugModule of
+  // NonSemantic.Shader.200 spec), we should not apply the rule "literals are
+  // not allowed for NonSemantic specification". This is a hack to avoid 
getting
+  // constant value instead of literal in such case.
+  const SPIRVExtInstSetKind ExtKind =
+      DebugInst->getExtOp() == SPIRVDebug::Instruction::ModuleINTEL
+          ? SPIRVEIS_OpenCL_DebugInfo_100
+          : DebugInst->getExtSetKind();
+  SPIRVWord Line = getConstantValueOrLiteral(Ops, LineIdx, ExtKind);
   DIFile *File = getFile(Ops[SourceIdx]);
   StringRef Name = getString(Ops[NameIdx]);
   StringRef ConfigMacros = getString(Ops[ConfigMacrosIdx]);
   StringRef IncludePath = getString(Ops[IncludePathIdx]);
   StringRef ApiNotes = getString(Ops[ApiNotesIdx]);
-  bool IsDecl =
-      getConstantValueOrLiteral(Ops, IsDeclIdx, DebugInst->getExtSetKind());
+  bool IsDecl = getConstantValueOrLiteral(Ops, IsDeclIdx, ExtKind);
   return getDIBuilder(DebugInst).createModule(
       Scope, Name, ConfigMacros, IncludePath, ApiNotes, File, Line, IsDecl);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/SPIRVToLLVMDbgTran.h
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/SPIRVToLLVMDbgTran.h
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/SPIRVToLLVMDbgTran.h
   2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/SPIRVToLLVMDbgTran.h
   2023-08-04 18:33:36.000000000 +0200
@@ -105,6 +105,9 @@
   MDNode *transDebugInlined(const SPIRVExtInst *Inst);
   MDNode *transDebugInlinedNonSemanticShader200(const SPIRVExtInst *Inst);
 
+  void appendToSourceLangLiteral(DICompileUnit *CompileUnit,
+                                 SPIRVWord SourceLang);
+
   DICompileUnit *transCompilationUnit(const SPIRVExtInst *DebugInst,
                                       const std::string CompilerVersion = "",
                                       const std::string Flags = "");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/SPIRVUtil.cpp
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/SPIRVUtil.cpp
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/SPIRVUtil.cpp
  2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/SPIRVUtil.cpp
  2023-08-04 18:33:36.000000000 +0200
@@ -1812,14 +1812,15 @@
   return true;
 }
 
-void setAttrByCalledFunc(CallInst *Call) {
+CallInst *setAttrByCalledFunc(CallInst *Call) {
   Function *F = Call->getCalledFunction();
   assert(F);
   if (F->isIntrinsic()) {
-    return;
+    return Call;
   }
   Call->setCallingConv(F->getCallingConv());
   Call->setAttributes(F->getAttributes());
+  return Call;
 }
 
 bool isSPIRVBuiltinVariable(GlobalVariable *GV,
@@ -1869,6 +1870,75 @@
 // %4 = call spir_func i64 @_Z13get_global_idj(i32 2) #1
 // %5 = insertelement <3 x i64> %3, i64 %4, i32 2
 // %6 = extractelement <3 x i64> %5, i32 0
+
+/// Recursively look through the uses of a global variable, including casts or
+/// gep offsets, to find all loads of the variable. Gep offsets that are non-0
+/// are accumulated in the AccumulatedOffset parameter, which will eventually 
be
+/// used to figure out which index of a variable is being used.
+static void replaceUsesOfBuiltinVar(Value *V, const APInt &AccumulatedOffset,
+                                    Function *ReplacementFunc) {
+  const DataLayout &DL = ReplacementFunc->getParent()->getDataLayout();
+  SmallVector<Instruction *, 4> InstsToRemove;
+  for (User *U : V->users()) {
+    if (auto *Cast = dyn_cast<CastInst>(U)) {
+      replaceUsesOfBuiltinVar(Cast, AccumulatedOffset, ReplacementFunc);
+      InstsToRemove.push_back(Cast);
+    } else if (auto *GEP = dyn_cast<GetElementPtrInst>(U)) {
+      APInt NewOffset = AccumulatedOffset.sextOrTrunc(
+          DL.getIndexSizeInBits(GEP->getPointerAddressSpace()));
+      if (!GEP->accumulateConstantOffset(DL, NewOffset))
+        llvm_unreachable("Illegal GEP of a SPIR-V builtin variable");
+      replaceUsesOfBuiltinVar(GEP, NewOffset, ReplacementFunc);
+      InstsToRemove.push_back(GEP);
+    } else if (auto *Load = dyn_cast<LoadInst>(U)) {
+      // Figure out which index the accumulated offset corresponds to. If we
+      // have a weird offset (e.g., trying to load byte 7), bail out.
+      Type *ScalarTy = ReplacementFunc->getReturnType();
+      APInt Index;
+      uint64_t Remainder;
+      APInt::udivrem(AccumulatedOffset, ScalarTy->getScalarSizeInBits() / 8,
+                     Index, Remainder);
+      if (Remainder != 0)
+        llvm_unreachable("Illegal GEP of a SPIR-V builtin variable");
+
+      IRBuilder<> Builder(Load);
+      Value *Replacement;
+      if (ReplacementFunc->getFunctionType()->getNumParams() == 0) {
+        if (Load->getType() != ScalarTy)
+          llvm_unreachable("Illegal use of a SPIR-V builtin variable");
+        Replacement =
+            setAttrByCalledFunc(Builder.CreateCall(ReplacementFunc, {}));
+      } else {
+        // The function has an index parameter.
+        if (auto *VecTy = dyn_cast<FixedVectorType>(Load->getType())) {
+          if (!Index.isZero())
+            llvm_unreachable("Illegal use of a SPIR-V builtin variable");
+          Replacement = UndefValue::get(VecTy);
+          for (unsigned I = 0; I < VecTy->getNumElements(); I++) {
+            Replacement = Builder.CreateInsertElement(
+                Replacement,
+                setAttrByCalledFunc(
+                    Builder.CreateCall(ReplacementFunc, 
{Builder.getInt32(I)})),
+                Builder.getInt32(I));
+          }
+        } else if (Load->getType() == ScalarTy) {
+          Replacement = setAttrByCalledFunc(Builder.CreateCall(
+              ReplacementFunc, {Builder.getInt32(Index.getZExtValue())}));
+        } else {
+          llvm_unreachable("Illegal load type of a SPIR-V builtin variable");
+        }
+      }
+      Load->replaceAllUsesWith(Replacement);
+      InstsToRemove.push_back(Load);
+    } else {
+      llvm_unreachable("Illegal use of a SPIR-V builtin variable");
+    }
+  }
+
+  for (Instruction *I : InstsToRemove)
+    I->eraseFromParent();
+}
+
 bool lowerBuiltinVariableToCall(GlobalVariable *GV,
                                 SPIRVBuiltinVariableKind Kind) {
   // There might be dead constant users of GV (for example, SPIRVLowerConstExpr
@@ -1904,113 +1974,7 @@
     Func->setDoesNotAccessMemory();
   }
 
-  // Collect instructions in these containers to remove them later.
-  std::vector<Instruction *> Loads;
-  std::vector<Instruction *> Casts;
-  std::vector<Instruction *> GEPs;
-
-  auto Replace = [&](std::vector<Value *> Arg, Instruction *I) {
-    auto *Call = CallInst::Create(Func, Arg, "", I);
-    Call->takeName(I);
-    setAttrByCalledFunc(Call);
-    SPIRVDBG(dbgs() << "[lowerBuiltinVariableToCall] " << *I << " -> " << *Call
-                    << '\n';)
-    I->replaceAllUsesWith(Call);
-  };
-
-  // If HasIndexArg is true, we create 3 built-in calls and insertelement to
-  // get 3-element vector filled with ids and replace uses of Load instruction
-  // with this vector.
-  // If HasIndexArg is false, the result of the Load instruction is the value
-  // which should be replaced with the Func.
-  // Returns true if Load was replaced, false otherwise.
-  auto ReplaceIfLoad = [&](User *I) {
-    auto *LD = dyn_cast<LoadInst>(I);
-    if (!LD)
-      return false;
-    std::vector<Value *> Vectors;
-    Loads.push_back(LD);
-    if (HasIndexArg) {
-      auto *VecTy = cast<FixedVectorType>(GVTy);
-      Value *EmptyVec = UndefValue::get(VecTy);
-      Vectors.push_back(EmptyVec);
-      const DebugLoc &DLoc = LD->getDebugLoc();
-      for (unsigned I = 0; I < VecTy->getNumElements(); ++I) {
-        auto *Idx = ConstantInt::get(Type::getInt32Ty(C), I);
-        auto *Call = CallInst::Create(Func, {Idx}, "", LD);
-        if (DLoc)
-          Call->setDebugLoc(DLoc);
-        setAttrByCalledFunc(Call);
-        auto *Insert = InsertElementInst::Create(Vectors.back(), Call, Idx);
-        if (DLoc)
-          Insert->setDebugLoc(DLoc);
-        Insert->insertAfter(Call);
-        Vectors.push_back(Insert);
-      }
-
-      Value *Ptr = LD->getPointerOperand();
-
-      if (isa<FixedVectorType>(Ptr->getType()->getPointerElementType())) {
-        LD->replaceAllUsesWith(Vectors.back());
-      } else {
-        auto *GEP = dyn_cast<GetElementPtrInst>(Ptr);
-        assert(GEP && "Unexpected pattern!");
-        assert(GEP->getNumIndices() == 2 && "Unexpected pattern!");
-        Value *Idx = GEP->getOperand(2);
-        Value *Vec = Vectors.back();
-        auto *NewExtract = ExtractElementInst::Create(Vec, Idx);
-        NewExtract->insertAfter(cast<Instruction>(Vec));
-        LD->replaceAllUsesWith(NewExtract);
-      }
-
-    } else {
-      Replace({}, LD);
-    }
-
-    return true;
-  };
-
-  // Go over the GV users, find Load and ExtractElement instructions and
-  // replace them with the corresponding function call.
-  for (auto *UI : GV->users()) {
-    // There might or might not be an addrspacecast instruction.
-    if (auto *ASCast = dyn_cast<AddrSpaceCastInst>(UI)) {
-      Casts.push_back(ASCast);
-      for (auto *CastUser : ASCast->users()) {
-        if (ReplaceIfLoad(CastUser))
-          continue;
-        if (auto *GEP = dyn_cast<GetElementPtrInst>(CastUser)) {
-          GEPs.push_back(GEP);
-          for (auto *GEPUser : GEP->users()) {
-            if (!ReplaceIfLoad(GEPUser))
-              llvm_unreachable("Unexpected pattern!");
-          }
-        } else {
-          llvm_unreachable("Unexpected pattern!");
-        }
-      }
-    } else if (auto *GEP = dyn_cast<GetElementPtrInst>(UI)) {
-      GEPs.push_back(GEP);
-      for (auto *GEPUser : GEP->users()) {
-        if (!ReplaceIfLoad(GEPUser))
-          llvm_unreachable("Unexpected pattern!");
-      }
-    } else if (!ReplaceIfLoad(UI)) {
-      llvm_unreachable("Unexpected pattern!");
-    }
-  }
-
-  auto Erase = [](std::vector<Instruction *> &ToErase) {
-    for (Instruction *I : ToErase) {
-      assert(I->hasNUses(0));
-      I->eraseFromParent();
-    }
-  };
-  // Order of erasing is important.
-  Erase(Loads);
-  Erase(GEPs);
-  Erase(Casts);
-
+  replaceUsesOfBuiltinVar(GV, APInt(64, 0), Func);
   return true;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/libSPIRV/SPIRV.debug.h
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/libSPIRV/SPIRV.debug.h
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/lib/SPIRV/libSPIRV/SPIRV.debug.h
 2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/lib/SPIRV/libSPIRV/SPIRV.debug.h
 2023-08-04 18:33:36.000000000 +0200
@@ -396,11 +396,12 @@
 
 namespace TypeSubrange {
 enum {
-  CountIdx        = 0,
-  LowerBoundIdx   = 1,
-  UpperBoundIdx   = 2,
+  LowerBoundIdx   = 0,
+  UpperBoundIdx   = 1,
+  CountIdx        = 2,
   StrideIdx       = 3,
-  OperandCount    = 4
+  MinOperandCount = 3,
+  MaxOperandCount = 4
 };
 }
 
@@ -932,7 +933,7 @@
 }
 
 namespace ImportedEntity {
-inline namespace OpenCL {
+namespace OpenCL {
 // it's bugged version, note 2nd index is missing
 // FIXME: need to remove it after some graceful period
 enum {
@@ -976,9 +977,9 @@
 
 // helper function to get parent scope of debug instruction, to be used
 // to determine with which compile unit the particular instruction relates
-inline bool hasDbgInstParentScopeIdx(const uint32_t Kind,
-                                     uint32_t &ParentScopeIdx,
-                                     const SPIRV::SPIRVExtInstSetKind ExtKind 
= SPIRV::SPIRVEIS_OpenCL) {
+inline bool hasDbgInstParentScopeIdx(
+    const uint32_t Kind, uint32_t &ParentScopeIdx,
+    const SPIRV::SPIRVExtInstSetKind ExtKind = SPIRV::SPIRVEIS_OpenCL) {
   switch (Kind) {
   case SPIRVDebug::Typedef:
     ParentScopeIdx = Typedef::ParentIdx;
@@ -1020,7 +1021,10 @@
     ParentScopeIdx = LocalVariable::ParentIdx;
     return true;
   case SPIRVDebug::ImportedEntity:
-    ParentScopeIdx = ImportedEntity::ParentIdx;
+    if (ExtKind == SPIRV::SPIRVEIS_OpenCL_DebugInfo_100)
+      ParentScopeIdx = ImportedEntity::OpenCL::ParentIdx;
+    else
+      ParentScopeIdx = ImportedEntity::NonSemantic::ParentIdx;
     return true;
   case SPIRVDebug::ModuleINTEL:
     ParentScopeIdx = ModuleINTEL::ParentIdx;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/InvalidSourceLanguageSPIRVtoLLVM.spvasm
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/InvalidSourceLanguageSPIRVtoLLVM.spvasm
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/InvalidSourceLanguageSPIRVtoLLVM.spvasm
   2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/InvalidSourceLanguageSPIRVtoLLVM.spvasm
   2023-08-04 18:33:36.000000000 +0200
@@ -36,5 +36,7 @@
                OpReturn
                OpFunctionEnd
 
-; CHECK: !{i32 2, !"Source Lang Literal", i32 42}
-; CHECK: !DICompileUnit(language: DW_LANG_OpenCL,
+; CHECK: {{![0-9]+}} = !{i32 2, !"Source Lang Literal", [[LIST:![0-9]+]]}
+; CHECK: [[LIST]] = !{[[ENTRY:![0-9]+]]}
+; CHECK: [[ENTRY]] = !{[[CU:![0-9]+]], i32 42}
+; CHECK: [[CU]] = distinct !DICompileUnit(language: DW_LANG_OpenCL
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/NonSemantic/DIImportedEntity.ll
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/NonSemantic/DIImportedEntity.ll
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/NonSemantic/DIImportedEntity.ll
   1970-01-01 01:00:00.000000000 +0100
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/NonSemantic/DIImportedEntity.ll
   2023-08-04 18:33:36.000000000 +0200
@@ -0,0 +1,50 @@
+; ModuleID = 
'/Volumes/Data/apple-internal/llvm/tools/clang/test/Modules/debug-info-moduleimport.m'
+; RUN: llvm-as < %s -o %t.bc
+
+; RUN: llvm-spirv --spirv-debug-info-version=nonsemantic-shader-100 %t.bc 
-spirv-text -o %t.spt
+; RUN: FileCheck %s --input-file %t.spt --check-prefix CHECK-SPIRV
+; RUN: llvm-spirv --spirv-debug-info-version=nonsemantic-shader-100 %t.bc -o 
%t.spv
+; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.ll
+; RUN: FileCheck %s --input-file %t.ll --check-prefix CHECK-LLVM
+
+; RUN: llvm-spirv --spirv-debug-info-version=nonsemantic-shader-200 %t.bc 
-spirv-text -o %t.spt
+; RUN: FileCheck %s --input-file %t.spt --check-prefix CHECK-SPIRV
+; RUN: llvm-spirv --spirv-debug-info-version=nonsemantic-shader-200 %t.bc -o 
%t.spv
+; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.ll
+; RUN: FileCheck %s --input-file %t.ll --check-prefix CHECK-LLVM
+
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "spir64-unknown-unknown"
+
+; CHECK-SPIRV-DAG: ExtInstImport [[#EISId:]] "NonSemantic.Shader.DebugInfo
+; CHECK-SPIRV-DAG: String [[#Name:]] ""
+; CHECK-SPIRV-DAG: TypeInt [[#Int:]] 32 0
+; CHECK-SPIRV-DAG: Constant [[#Int]] [[#One:]] 1 
+; CHECK-SPIRV-DAG: Constant [[#Int]] [[#Zero:]] 0
+; CHECK-SPIRV-DAG: Constant [[#Int]] [[#Five:]] 5
+; CHECK-SPIRV: ExtInst [[#]] [[#Source:]] [[#]] DebugSource
+; CHECK-SPIRV: ExtInst [[#]] [[#CU:]] [[#]] DebugCompilationUnit
+; CHECK-SPIRV: ExtInst [[#]] [[#Typedef:]] [[#]] DebugTypedef
+; CHECK-SPIRV: ExtInst [[#]] [[#]] [[#EISId]] DebugImportedEntity [[#Name]] 
[[#One]] [[#Source]] [[#Typedef]] [[#Five]] [[#Zero]] [[#CU]] {{$}}
+
+; CHECK-LLVM: ![[#CU:]] = distinct !DICompileUnit(language: DW_LANG_OpenCL, 
file: ![[#File:]],{{.*}}isOptimized: false, runtimeVersion: 0, emissionKind: 
FullDebug, imports: ![[#Import:]])
+; CHECK-LLVM: ![[#File]] = !DIFile(filename: "<stdin>", directory: 
"/llvm/tools/clang/test/Modules")
+; CHECK-LLVM: ![[#Import]] = !{![[#Entity:]]}
+; CHECK-LLVM: ![[#Entity]] = !DIImportedEntity(tag: 
DW_TAG_imported_declaration, scope: ![[#CU]], entity: ![[#Typedef:]], file: 
![[#File]], line: 5)
+; CHECK-LLVM: ![[#Typedef]] = !DIDerivedType(tag: DW_TAG_typedef, name: 
"max_align_t", file: ![[#File]], baseType: ![[#]])
+; CHECK-LLVM: !DICompositeType(tag: DW_TAG_structure_type, file: ![[#File]], 
line: 5, size: 256, flags: DIFlagFwdDecl, elements: ![[#]], identifier: 
"_ZTS11max_align_t")
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!6, !7}
+!llvm.ident = !{!8}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_OpenCL, file: !1, producer: 
"LLVM version 3.7.0", isOptimized: false, runtimeVersion: 2, emissionKind: 
FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !3,  sysroot: 
"/")
+!1 = !DIFile(filename: "/llvm/tools/clang/test/Modules/<stdin>", directory: 
"/")
+!2 = !{}
+!3 = !{!4}
+!4 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !0, entity: 
!9, file: !1, line: 5)
+!6 = !{i32 2, !"Dwarf Version", i32 4}
+!7 = !{i32 2, !"Debug Info Version", i32 3}
+!8 = !{!"LLVM version 3.7.0"}
+!9 = !DIDerivedType(tag: DW_TAG_typedef, name: "max_align_t", file: !1, 
baseType: !10)
+!10 = !DICompositeType(tag: DW_TAG_structure_type, file: !1, line: 5, size: 
256, flags: DIFlagFwdDecl, elements: !2, identifier: "_ZTS11max_align_t")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/NonSemantic/Shader200/DebugInfoSubrange.ll
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/NonSemantic/Shader200/DebugInfoSubrange.ll
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/NonSemantic/Shader200/DebugInfoSubrange.ll
        2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/NonSemantic/Shader200/DebugInfoSubrange.ll
        2023-08-04 18:33:36.000000000 +0200
@@ -28,12 +28,12 @@
 ; CHECK-SPIRV: [[#DebugFuncId:]] [[#EISId]] DebugFunction
 ; CHECK-SPIRV: [[#LocalVarId:]] [[#EISId]] DebugLocalVariable 
[[#LocalVarNameId]] [[#]] [[#]] [[#]] [[#]] [[#DebugFuncId]]
 ; CHECK-SPIRV: [[#DebugTypeTemplate:]] [[#EISId]] DebugTypeTemplate 
[[#DebugFuncId]]
-; CHECK-SPIRV: [[#EISId]] DebugTypeSubrange [[#DINoneId]] [[#Constant1Id]] 
[[#LocalVarId]]  [[#DINoneId]]
+; CHECK-SPIRV: [[#EISId]] DebugTypeSubrange [[#Constant1Id]] [[#LocalVarId]]  
[[#DINoneId]] {{$}}
 
 ; CHECK-SPIRV: [[#DIExprId:]] [[#EISId]] DebugExpression
-; CHECK-SPIRV: [[#EISId]] DebugTypeSubrange [[#DINoneId]] [[#DIExprId]] 
[[#DIExprId]] [[#DINoneId]]
+; CHECK-SPIRV: [[#EISId]] DebugTypeSubrange [[#DIExprId]] [[#DIExprId]] 
[[#DINoneId]] {{$}}
 
-; CHECK-SPIRV: [[#EISId]] DebugTypeSubrange [[#Constant1000Id]] 
[[#Constant1Id]] [[#DINoneId]] [[#DINoneId]]
+; CHECK-SPIRV: [[#EISId]] DebugTypeSubrange [[#Constant1Id]] [[#DINoneId]] 
[[#Constant1000Id]] {{$}}
 
 ; CHECK-SPIRV: [[#EISId]] DebugLine [[#]] [[#Constant15Id]] [[#Constant15Id]] 
[[#Constant67Id]] [[#Constant68Id]]
 ; CHECK-SPIRV: [[#EISId]] DebugLine [[#]] [[#Constant27Id]] [[#Constant27Id]] 
[[#Constant24Id]] [[#Constant25Id]]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/NonSemantic/Shader200/DebugTypeDef.ll
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/NonSemantic/Shader200/DebugTypeDef.ll
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/NonSemantic/Shader200/DebugTypeDef.ll
     1970-01-01 01:00:00.000000000 +0100
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/NonSemantic/Shader200/DebugTypeDef.ll
     2023-08-04 18:33:36.000000000 +0200
@@ -0,0 +1,56 @@
+; This test covers assertion "Typedef should have a parent scope"
+
+; RUN: llvm-as %s -o %t.bc
+; RUN: llvm-spirv %t.bc -spirv-text 
--spirv-debug-info-version=nonsemantic-shader-200 -o %t.spt
+; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
+; RUN: llvm-spirv %t.bc -o %t.spv 
--spirv-debug-info-version=nonsemantic-shader-200
+; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
+; RUN: llvm-dis %t.rev.bc
+; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM
+
+; CHECK-SPIRV: String [[#TestStr:]] "test.cpp"
+; CHECK-SPIRV: String [[#StdStr:]] "stddef.h"
+; CHECK-SPIRV: [[#SourceCpp:]] [[#]] DebugSource [[#TestStr]]
+; CHECK-SPIRV: [[#Scope:]] [[#]] DebugCompilationUnit [[#]] [[#]] 
[[#SourceCpp]]
+; CHECK-SPIRV: [[#SourceHeader:]] [[#]] DebugSource [[#StdStr]]
+; CHECK-SPIRV: DebugTypedef [[#]] [[#]] [[#SourceHeader]] [[#]] [[#]] 
[[#Scope]]
+; CHECK-SPIRV: DebugEntryPoint [[#]] [[#Scope]]
+
+; CHECK-LLVM: DW_TAG_typedef
+target datalayout = 
"e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
+target triple = "spir64"
+
+$_ZTSZ4mainEUlvE_ = comdat any
+
+; Function Attrs: convergent mustprogress norecurse nounwind
+define weak_odr dso_local spir_kernel void @_ZTSZ4mainEUlvE_() #0 comdat !dbg 
!14 {
+entry:
+  ret void
+}
+
+attributes #0 = { convergent mustprogress norecurse nounwind }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!10, !11, !12, !13}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, 
producer: "clang based compiler", isOptimized: true, runtimeVersion: 0, 
emissionKind: FullDebug, enums: !2, globals: !3, imports: !2, 
splitDebugInlining: false, nameTableKind: None)
+!1 = !DIFile(filename: "test.cpp", directory: "")
+!2 = !{}
+!3 = !{!4}
+!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression(DW_OP_constu, 
175, DW_OP_stack_value))
+!5 = distinct !DIGlobalVariable(name: "N", scope: !0, file: !1, line: 7, type: 
!6, isLocal: true, isDefinition: true)
+!6 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !7)
+!7 = !DIDerivedType(tag: DW_TAG_typedef, name: "size_t", file: !8, line: 62, 
baseType: !9)
+!8 = !DIFile(filename: "stddef.h", directory: "")
+!9 = !DIBasicType(name: "unsigned long", size: 64, encoding: DW_ATE_unsigned)
+!10 = !{i32 7, !"Dwarf Version", i32 4}
+!11 = !{i32 2, !"Debug Info Version", i32 3}
+!12 = !{i32 1, !"wchar_size", i32 4}
+!13 = !{i32 7, !"frame-pointer", i32 2}
+!14 = distinct !DISubprogram(name: "_ZTSZ4mainEUlvE_", scope: !1, file: !1, 
line: 24, type: !15, flags: DIFlagArtificial | DIFlagPrototyped | 
DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: 
!0, retainedNodes: !2)
+!15 = !DISubroutineType(cc: DW_CC_nocall, types: !16)
+!16 = !{null}
+!17 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !18, entity: 
!19, file: !1, line: 58)
+!18 = !DINamespace(name: "std", scope: null)
+!19 = !DIDerivedType(tag: DW_TAG_typedef, name: "max_align_t", file: !1, 
baseType: !20)
+!20 = !DICompositeType(tag: DW_TAG_structure_type, file: !8, line: 19, size: 
256, flags: DIFlagFwdDecl, elements: !2, identifier: "_ZTS11max_align_t")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/NonSemantic/Shader200/FortranDynamicArrayExpr.ll
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/NonSemantic/Shader200/FortranDynamicArrayExpr.ll
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/NonSemantic/Shader200/FortranDynamicArrayExpr.ll
  2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/NonSemantic/Shader200/FortranDynamicArrayExpr.ll
  2023-08-04 18:33:36.000000000 +0200
@@ -25,8 +25,8 @@
 ; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgExprAssociated:]] [[#Import]] 
DebugExpression [[#]] [[#]] [[#]] [[#]] {{$}}
 ; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgExprLowerBound:]] [[#Import]] 
DebugExpression [[#]] [[#]] [[#]] {{$}}
 ; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgExprUpperBound:]] [[#Import]] 
DebugExpression [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] {{$}}
-; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgExprCount:]] [[#Import]] 
DebugExpression [[#]] [[#]] [[#]] {{$}}
-; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgSubRangeId:]] [[#Import]] 
DebugTypeSubrange [[#DbgInfoNone]] [[#DbgExprLowerBound]] 
[[#DbgExprUpperBound]] [[#DbgExprCount]]
+; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgExprStride:]] [[#Import]] 
DebugExpression [[#]] [[#]] [[#]] {{$}}
+; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgSubRangeId:]] [[#Import]] 
DebugTypeSubrange [[#DbgExprLowerBound]] [[#DbgExprUpperBound]] 
[[#DbgInfoNone]] [[#DbgExprStride]]
 ; CHECK-SPIRV: ExtInst [[#VoidT]] [[#DbgArrayId:]] [[#Import]] 
DebugTypeArrayDynamic [[#ArrayBasicT]] [[#DbgExprLocation]] 
[[#DbgExprAssociated]] [[#DbgInfoNone]] [[#DbgInfoNone]] [[#DbgSubRangeId]]
 
 ; CHECK-LLVM: %[[#Array:]] = alloca
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/X86/DIModuleContext.ll
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/X86/DIModuleContext.ll
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/X86/DIModuleContext.ll
    2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/X86/DIModuleContext.ll
    2023-08-04 18:33:36.000000000 +0200
@@ -2,6 +2,13 @@
 ; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_debug_module %t.bc -o %t.spv
 ; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.ll
 
+; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_debug_module %t.bc -o %t.spv 
--spirv-debug-info-version=nonsemantic-shader-100
+; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.ll
+; RUN: llc -mtriple=x86_64-apple-macosx %t.ll -o - -filetype=obj \
+; RUN:   | llvm-dwarfdump -debug-info - | FileCheck %s
+
+; RUN: llvm-spirv %t.bc -o %t.spv 
--spirv-debug-info-version=nonsemantic-shader-200
+; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.ll
 ; RUN: llc -mtriple=x86_64-apple-macosx %t.ll -o - -filetype=obj \
 ; RUN:   | llvm-dwarfdump -debug-info - | FileCheck %s
 ; CHECK: DW_TAG_module
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/X86/Fortran-DIModule.ll
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/X86/Fortran-DIModule.ll
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/X86/Fortran-DIModule.ll
   2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/X86/Fortran-DIModule.ll
   2023-08-04 18:33:36.000000000 +0200
@@ -2,6 +2,13 @@
 ; RUN: llvm-as < %s -o %t.bc
 ; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_debug_module %t.bc -o %t.spv
 ; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.ll
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu %t.ll -filetype=obj -o - | \
+; RUN:   llvm-dwarfdump - | FileCheck %s
+
+; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_debug_module %t.bc -o %t.spv 
--spirv-debug-info-version=nonsemantic-shader-100
+; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.ll
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu %t.ll -filetype=obj -o - | \
+; RUN:   llvm-dwarfdump - | FileCheck %s
 
 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu %t.ll -filetype=obj -o - | \
 ; RUN:   llvm-dwarfdump - | FileCheck %s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/X86/dimodule-external-fortran.ll
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/X86/dimodule-external-fortran.ll
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/DebugInfo/X86/dimodule-external-fortran.ll
  2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/DebugInfo/X86/dimodule-external-fortran.ll
  2023-08-04 18:33:36.000000000 +0200
@@ -25,6 +25,14 @@
 ; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.ll
 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu -filetype=obj  %t.ll -o - | 
llvm-dwarfdump - | FileCheck %s
 
+; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_debug_module %t.bc -o %t.spv 
--spirv-debug-info-version=nonsemantic-shader-100
+; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.ll
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -filetype=obj  %t.ll -o - | 
llvm-dwarfdump - | FileCheck %s
+
+; RUN: llvm-spirv %t.bc -o %t.spv 
--spirv-debug-info-version=nonsemantic-shader-200
+; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o %t.ll
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -filetype=obj  %t.ll -o - | 
llvm-dwarfdump - | FileCheck %s
+
 ; CHECK: [[DIE_ID:0x[0-9a-f]+]]: DW_TAG_module
 ; CHECK-NEXT:                      DW_AT_name    ("external_module")
 ; CHECK-NEXT:                      DW_AT_declaration     (true)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/builtin-vars-gep.ll
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/builtin-vars-gep.ll
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/builtin-vars-gep.ll
 2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/builtin-vars-gep.ll
 2023-08-04 18:33:36.000000000 +0200
@@ -17,25 +17,33 @@
   %0 = addrspacecast <3 x i64> addrspace(1)* @__spirv_BuiltInWorkgroupSize to 
<3 x i64> addrspace(4)*
   %1 = getelementptr <3 x i64>, <3 x i64> addrspace(4)* %0, i64 0, i64 0
 ; CHECK-LLVM: %[[GLocalSize0:[0-9]+]] = call spir_func i64 
@_Z14get_local_sizej(i32 0) #1
-; CHECK-LLVM: %[[Ins0:[0-9]+]] = insertelement <3 x i64> undef, i64 
%[[GLocalSize0]], i32 0
-; CHECK-LLVM: %[[GLocalSize1:[0-9]+]] = call spir_func i64 
@_Z14get_local_sizej(i32 1) #1
-; CHECK-LLVM: %[[Ins1:[0-9]+]] = insertelement <3 x i64> %[[Ins0]], i64 
%[[GLocalSize1]], i32 1
-; CHECK-LLVM: %[[GLocalSize2:[0-9]+]] = call spir_func i64 
@_Z14get_local_sizej(i32 2) #1
-; CHECK-LLVM: %[[Ins2:[0-9]+]] = insertelement <3 x i64> %[[Ins1]], i64 
%[[GLocalSize2]], i32 2
-; CHECK-LLVM: %[[Extract:[0-9]+]] = extractelement <3 x i64> %[[Ins2]], i64 0
   %2 = addrspacecast <3 x i64> addrspace(1)* @__spirv_BuiltInWorkgroupSize to 
<3 x i64> addrspace(4)*
   %3 = getelementptr <3 x i64>, <3 x i64> addrspace(4)* %2, i64 0, i64 2
   %4 = load i64, i64 addrspace(4)* %1, align 32
-  %5 = load i64, i64 addrspace(4)* %3, align 8
-; CHECK-LLVM: %[[GLocalSize01:[0-9]+]] = call spir_func i64 
@_Z14get_local_sizej(i32 0) #1
-; CHECK-LLVM: %[[Ins01:[0-9]+]] = insertelement <3 x i64> undef, i64 
%[[GLocalSize01]], i32 0
-; CHECK-LLVM: %[[GLocalSize11:[0-9]+]] = call spir_func i64 
@_Z14get_local_sizej(i32 1) #1
-; CHECK-LLVM: %[[Ins11:[0-9]+]] = insertelement <3 x i64> %[[Ins01]], i64 
%[[GLocalSize11]], i32 1
-; CHECK-LLVM: %[[GLocalSize21:[0-9]+]] = call spir_func i64 
@_Z14get_local_sizej(i32 2) #1
-; CHECK-LLVM: %[[Ins21:[0-9]+]] = insertelement <3 x i64> %[[Ins11]], i64 
%[[GLocalSize21]], i32 2
-; CHECK-LLVM: %[[Extract1:[0-9]+]] = extractelement <3 x i64> %[[Ins21]], i64 2
-; CHECK-LLVM:  mul i64 %[[Extract]], %[[Extract1]]
+  %5 = load i64,i64 addrspace(4)* %3, align 8
+; CHECK-LLVM: %[[GLocalSize2:[0-9]+]] = call spir_func i64 
@_Z14get_local_sizej(i32 2) #1
+; CHECK-LLVM:  mul i64 %[[GLocalSize0]], %[[GLocalSize2]]
   %mul = mul i64 %4, %5
   ret void
 }
 
+; Function Attrs: alwaysinline nounwind mustprogress convergent
+define spir_func void @foo_i8gep() {
+entry:
+  %GroupID = alloca [3 x i64], align 8
+  %0 = addrspacecast <3 x i64> addrspace(1)* @__spirv_BuiltInWorkgroupSize to 
<3 x i64> addrspace(4)*
+  %1 = bitcast <3 x i64> addrspace(4)* %0 to i8 addrspace(4)*
+  %2 = getelementptr i8, i8 addrspace(4)* %1, i64 0
+; CHECK-LLVM: %[[GLocalSize0:[0-9]+]] = call spir_func i64 
@_Z14get_local_sizej(i32 0) #1
+  %3 = addrspacecast <3 x i64> addrspace(1)* @__spirv_BuiltInWorkgroupSize to 
<3 x i64> addrspace(4)*
+  %4 = bitcast <3 x i64> addrspace(4)* %3 to i8 addrspace(4)*
+  %5 = getelementptr i8, i8 addrspace(4)* %4, i64 16
+  %6 = bitcast i8 addrspace(4)* %2 to i64 addrspace(4)*
+  %7 = bitcast i8 addrspace(4)* %5 to i64 addrspace(4)*
+  %8 = load i64, i64 addrspace(4)* %6, align 32
+  %9 = load i64, i64 addrspace(4)* %7, align 8
+; CHECK-LLVM: %[[GLocalSize2:[0-9]+]] = call spir_func i64 
@_Z14get_local_sizej(i32 2) #1
+; CHECK-LLVM:  mul i64 %[[GLocalSize0]], %[[GLocalSize2]]
+  %mul = mul i64 %8, %9
+  ret void
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/transcoding/builtin_vars_gep.ll
 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/transcoding/builtin_vars_gep.ll
--- 
old/SPIRV-LLVM-Translator-23f398bf369093b1fd67459db8071ffcc6b92658/test/transcoding/builtin_vars_gep.ll
     2023-06-22 11:29:51.000000000 +0200
+++ 
new/SPIRV-LLVM-Translator-43baf90f96fb9df607595b63858fd9e85fbb2604/test/transcoding/builtin_vars_gep.ll
     2023-08-04 18:33:36.000000000 +0200
@@ -23,20 +23,8 @@
 entry:
   %0 = load i64, i64 addrspace(1)* getelementptr (<3 x i64>, <3 x i64> 
addrspace(1)* @__spirv_BuiltInGlobalInvocationId, i64 0, i64 0), align 32
   ; CHECK-OCL-IR: %[[#ID1:]] = call spir_func i64 @_Z13get_global_idj(i32 0)
-  ; CHECK-OCL-IR: %[[#VEC1:]] = insertelement <3 x i64> undef, i64 %[[#ID1]], 
i32 0
-  ; CHECK-OCL-IR: %[[#ID2:]] = call spir_func i64 @_Z13get_global_idj(i32 1)
-  ; CHECK-OCL-IR: %[[#VEC2:]] = insertelement <3 x i64> %[[#VEC1]], i64 
%[[#ID2]], i32 1
-  ; CHECK-OCL-IR: %[[#ID3:]] = call spir_func i64 @_Z13get_global_idj(i32 2)
-  ; CHECK-OCL-IR: %[[#VEC3:]] = insertelement <3 x i64> %[[#VEC2]], i64 
%[[#ID3]], i32 2
-  ; CHECK-OCL-IR: %[[#]] = extractelement <3 x i64> %[[#VEC3]], i64 0
 
   ; CHECK-SPV-IR: %[[#ID1:]] = call spir_func i64 
@_Z33__spirv_BuiltInGlobalInvocationIdi(i32 0)
-  ; CHECK-SPV-IR: %[[#VEC1:]] = insertelement <3 x i64> undef, i64 %[[#ID1]], 
i32 0
-  ; CHECK-SPV-IR: %[[#ID2:]] = call spir_func i64 
@_Z33__spirv_BuiltInGlobalInvocationIdi(i32 1)
-  ; CHECK-SPV-IR: %[[#VEC2:]] = insertelement <3 x i64> %[[#VEC1]], i64 
%[[#ID2]], i32 1
-  ; CHECK-SPV-IR: %[[#ID3:]] = call spir_func i64 
@_Z33__spirv_BuiltInGlobalInvocationIdi(i32 2)
-  ; CHECK-SPV-IR: %[[#VEC3:]] = insertelement <3 x i64> %[[#VEC2]], i64 
%[[#ID3]], i32 2
-  ; CHECK-SPV-IR: %[[#]] = extractelement <3 x i64> %[[#VEC3]], i64 0
 
   ret void
 }

++++++ vc-intrinsics.zip ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h
 
new/vc-intrinsics-0.13.0/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h
--- 
old/vc-intrinsics-0.12.3/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h
        2023-03-17 23:57:19.000000000 +0100
+++ 
new/vc-intrinsics-0.13.0/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h
        2023-05-16 01:51:29.000000000 +0200
@@ -466,6 +466,13 @@
     case GenXIntrinsic::genx_lsc_load_quad_bti:
     case GenXIntrinsic::genx_lsc_load_quad_slm:
     case GenXIntrinsic::genx_lsc_load_quad_stateless:
+    case GenXIntrinsic::genx_lsc_load_merge_bti:
+    case GenXIntrinsic::genx_lsc_load_merge_stateless:
+    case GenXIntrinsic::genx_lsc_load_merge_slm:
+    case GenXIntrinsic::genx_lsc_load_merge_bindless:
+    case GenXIntrinsic::genx_lsc_load_merge_quad_bti:
+    case GenXIntrinsic::genx_lsc_load_merge_quad_slm:
+    case GenXIntrinsic::genx_lsc_load_merge_quad_stateless:
       return LSCCategory::Load;
     case GenXIntrinsic::genx_lsc_load2d_stateless:
       return LSCCategory::Load2D;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXMetadata.h
 
new/vc-intrinsics-0.13.0/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXMetadata.h
--- 
old/vc-intrinsics-0.12.3/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXMetadata.h
  2023-03-17 23:57:19.000000000 +0100
+++ 
new/vc-intrinsics-0.13.0/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXMetadata.h
  2023-05-16 01:51:29.000000000 +0200
@@ -57,6 +57,7 @@
 static constexpr const char VCArgumentDesc[] = "VCArgumentDesc";
 static constexpr const char VCSIMTCall[] = "VCSIMTCall";
 static constexpr const char VCNamedBarrierCount[] = "VCNamedBarrierCount";
+static constexpr const char VCMediaBlockIO[] = "VCMediaBlockIO";
 } // namespace VCFunctionMD
 
 enum KernelMDOp {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/lib/GenXIntrinsics/AdaptorsCommon.h 
new/vc-intrinsics-0.13.0/GenXIntrinsics/lib/GenXIntrinsics/AdaptorsCommon.h
--- old/vc-intrinsics-0.12.3/GenXIntrinsics/lib/GenXIntrinsics/AdaptorsCommon.h 
2023-03-17 23:57:19.000000000 +0100
+++ new/vc-intrinsics-0.13.0/GenXIntrinsics/lib/GenXIntrinsics/AdaptorsCommon.h 
2023-05-16 01:51:29.000000000 +0200
@@ -134,8 +134,11 @@
 static constexpr unsigned SPIRVAddressingModel64 = 2;
 
 // Has to correspond to spir address space encoding.
+static constexpr unsigned SPIRVPrivateAS = 0;
 static constexpr unsigned SPIRVGlobalAS = 1;
 static constexpr unsigned SPIRVConstantAS = 2;
+static constexpr unsigned SPIRVLocalAS = 3;
+static constexpr unsigned SPIRVGenericAS = 4;
 } // namespace SPIRVParams
 
 inline unsigned getOpaqueTypeAddressSpace(SPIRVType Ty) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp 
new/vc-intrinsics-0.13.0/GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp
--- 
old/vc-intrinsics-0.12.3/GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp   
    2023-03-17 23:57:19.000000000 +0100
+++ 
new/vc-intrinsics-0.13.0/GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp   
    2023-05-16 01:51:29.000000000 +0200
@@ -437,12 +437,21 @@
       Result += "vararg";
     // Ensure nested function types are distinguishable.
     Result += "f";
-  } else if (isa<VectorType>(Ty))
+  } else if (isa<VectorType>(Ty)) {
     Result += "v" +
               utostr(VCINTR::VectorType::getNumElements(cast<VectorType>(Ty))) 
+
               getMangledTypeStr(cast<VectorType>(Ty)->getElementType());
-  else if (Ty)
+#if VC_INTR_LLVM_VERSION_MAJOR >= 16
+  } else if (auto *TargetTy = dyn_cast<TargetExtType>(Ty)) {
+    Result += "t_" + TargetTy->getName().str();
+    for (auto *PTy : TargetTy->type_params())
+      Result += "_" + getMangledTypeStr(PTy);
+    for (auto I : TargetTy->int_params())
+      Result += "_" + llvm::utostr(I);
+#endif // VC_INTR_LLVM_VERSION_MAJOR >= 16
+  } else if (Ty) {
     Result += EVT::getEVT(Ty).getEVTString();
+  }
 
   return Result;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVReaderAdaptor.cpp
 
new/vc-intrinsics-0.13.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVReaderAdaptor.cpp
--- 
old/vc-intrinsics-0.12.3/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVReaderAdaptor.cpp
       2023-03-17 23:57:19.000000000 +0100
+++ 
new/vc-intrinsics-0.13.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVReaderAdaptor.cpp
       2023-05-16 01:51:29.000000000 +0200
@@ -318,7 +318,8 @@
 static Value *getOriginalValue(Argument &Arg) {
   if (Arg.hasOneUse()) {
     User *U = Arg.user_back();
-    if (isArgConvIntrinsic(U))
+    if (isArgConvIntrinsic(U) || isa<BitCastInst>(U) ||
+        isa<AddrSpaceCastInst>(U) || isa<IntToPtrInst>(U))
       return U;
   }
 
@@ -468,7 +469,7 @@
 // Rewrite function if it has SPIRV types as parameters.
 // Function
 //  define spir_kernel @foo(%opencl.image2d_rw_t addrspace(1)* %im) {
-//    %conv = call @llvm.genx.address.convert(%im)
+//    %conv = ptrtoint %opencl.image2d_rw_t addrspace(1)* %im to i32
 //   ...
 //  }
 // will be changed to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVWriterAdaptor.cpp
 
new/vc-intrinsics-0.13.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVWriterAdaptor.cpp
--- 
old/vc-intrinsics-0.12.3/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVWriterAdaptor.cpp
       2023-03-17 23:57:19.000000000 +0100
+++ 
new/vc-intrinsics-0.13.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVWriterAdaptor.cpp
       2023-05-16 01:51:29.000000000 +0200
@@ -1,6 +1,6 @@
 /*========================== begin_copyright_notice 
============================
 
-Copyright (C) 2020-2021 Intel Corporation
+Copyright (C) 2020-2023 Intel Corporation
 
 SPDX-License-Identifier: MIT
 
@@ -11,14 +11,15 @@
 #include "AdaptorsCommon.h"
 #include "GenXSingleElementVectorUtil.h"
 
-#include "llvm/GenXIntrinsics/GenXSPIRVWriterAdaptor.h"
 #include "llvm/GenXIntrinsics/GenXIntrinsics.h"
 #include "llvm/GenXIntrinsics/GenXMetadata.h"
+#include "llvm/GenXIntrinsics/GenXSPIRVWriterAdaptor.h"
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Function.h"
+#include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/Metadata.h"
 #if VC_INTR_LLVM_VERSION_MAJOR >= 16
 #include <llvm/Support/ModRef.h>
@@ -180,7 +181,9 @@
   std::string TypeName;
   switch (Desc.Ty) {
   case SPIRVType::Pointer:
-    return getGlobalPtrType(Arg.getContext());
+    if (!Arg.hasByValAttr())
+      return getGlobalPtrType(Arg.getContext());
+    LLVM_FALLTHROUGH;
   case SPIRVType::Other:
   case SPIRVType::None:
     return Arg.getType();
@@ -189,14 +192,83 @@
   }
 }
 
+#if VC_INTR_LLVM_VERSION_MAJOR >= 16
+static Type *getImageTargetType(SPIRVArgDesc Desc, Argument &Arg) {
+  auto &Ctx = Arg.getContext();
+  auto *VoidTy = Type::getVoidTy(Ctx);
+
+  SmallVector<unsigned, 7> IntParams = {
+      0, 0, 0, 0, 0, 0, static_cast<unsigned>(Desc.Acc)};
+
+  switch (Desc.Ty) {
+  case SPIRVType::Image1d:
+    break;
+  case SPIRVType::Image1dArray:
+    IntParams[2] = 1;
+    break;
+  case SPIRVType::Image1dBuffer:
+    IntParams[0] = 5;
+    break;
+  case SPIRVType::Image2d:
+    IntParams[0] = 1;
+    break;
+  case SPIRVType::Image2dArray:
+    IntParams[0] = 1;
+    IntParams[2] = 1;
+    break;
+  case SPIRVType::Image3d:
+    IntParams[0] = 2;
+    break;
+  default:
+    llvm_unreachable("Only images are supported here");
+  }
+
+  return TargetExtType::get(Ctx, "spirv.Image", {VoidTy}, IntParams);
+}
+
+static Type *getArgTargetTypeFromDesc(SPIRVArgDesc Desc, Argument &Arg) {
+  auto &Ctx = Arg.getContext();
+  SmallVector<unsigned, 1> Acc = {static_cast<unsigned>(Desc.Acc)};
+  switch (Desc.Ty) {
+  default:
+    return getImageTargetType(Desc, Arg);
+  case SPIRVType::Sampler:
+    return TargetExtType::get(Ctx, "spirv.Sampler");
+  case SPIRVType::Pointer:
+    if (!Arg.hasByValAttr())
+      return getGlobalPtrType(Ctx);
+    LLVM_FALLTHROUGH;
+  case SPIRVType::Other:
+  case SPIRVType::None:
+    return Arg.getType();
+  case SPIRVType::Buffer:
+    return TargetExtType::get(Ctx, "spirv.BufferSurfaceINTEL", {}, Acc);
+  case SPIRVType::Image2dMediaBlock:
+    return getImageTargetType(SPIRVArgDesc(SPIRVType::Image2d, Desc.Acc), Arg);
+  }
+}
+#endif // VC_INTR_LLVM_VERSION_MAJOR >= 16
+
 static Function *
 transformKernelSignature(Function &F, const std::vector<SPIRVArgDesc> &Descs) {
   SmallVector<Type *, 8> NewParams;
+
+  auto GetArgType =
+#if VC_INTR_LLVM_VERSION_MAJOR >= 16
+      [UseTargetTypes = !F.getContext().supportsTypedPointers()](
+          SPIRVArgDesc Desc, Argument &Arg) {
+        if (UseTargetTypes)
+          return getArgTargetTypeFromDesc(Desc, Arg);
+        return getArgTypeFromDesc(Desc, Arg);
+      };
+#else  // VC_INTR_LLVM_VERSION_MAJOR >= 16
+      [](SPIRVArgDesc Desc, Argument &Arg) {
+        return getArgTypeFromDesc(Desc, Arg);
+      };
+#endif // VC_INTR_LLVM_VERSION_MAJOR >= 16
+
   std::transform(Descs.begin(), Descs.end(), F.arg_begin(),
-                 std::back_inserter(NewParams),
-                 [](SPIRVArgDesc Desc, Argument &Arg) {
-                   return getArgTypeFromDesc(Desc, Arg);
-                 });
+                 std::back_inserter(NewParams), GetArgType);
 
   assert(!F.isVarArg() && "Kernel cannot be vararg");
   auto *NewFTy = FunctionType::get(F.getReturnType(), NewParams, false);
@@ -210,6 +282,14 @@
   for (int i = 0, e = Descs.size(); i != e; ++i) {
     if (Descs[i].Ty == SPIRVType::None)
       continue;
+#if VC_INTR_LLVM_VERSION_MAJOR >= 16
+    if (!F.getContext().supportsTypedPointers() &&
+        Descs[i].Ty == SPIRVType::Image2dMediaBlock) {
+      AttrBuilder AttrBuilder(NewF->getContext());
+      AttrBuilder.addAttribute(VCFunctionMD::VCMediaBlockIO);
+      NewF->addParamAttrs(i, AttrBuilder);
+    }
+#endif // VC_INTR_LLVM_VERSION_MAJOR >= 16
 
     NewF->removeParamAttr(i, VCFunctionMD::VCArgumentKind);
     NewF->removeParamAttr(i, VCFunctionMD::VCArgumentDesc);
@@ -222,30 +302,48 @@
 
 // Replace old arguments with new ones generating conversion
 // intrinsics for types that were changed.
-static Instruction *rewriteArgumentUses(Argument &OldArg, Argument &NewArg) {
+static void rewriteArgumentUses(Instruction *InsertBefore, Argument &OldArg,
+                                Argument &NewArg) {
   NewArg.takeName(&OldArg);
 
   Type *OldTy = OldArg.getType();
   Type *NewTy = NewArg.getType();
   if (OldTy == NewTy) {
     OldArg.replaceAllUsesWith(&NewArg);
-    return nullptr;
+    return;
   }
 
-  Module *M = OldArg.getParent()->getParent();
-  Function *ConvFn = GenXIntrinsic::getGenXDeclaration(
-      M, GenXIntrinsic::genx_address_convert, {OldTy, NewTy});
-  ConvFn->addFnAttr(VCFunctionMD::VCFunction);
-  auto *Conv = CallInst::Create(ConvFn, {&NewArg});
-#if VC_INTR_LLVM_VERSION_MAJOR >= 16
-  // Modify ReadNone attribute to support llvm16
-  if (ConvFn->getFnAttribute(llvm::Attribute::ReadNone).isValid()) {
-    ConvFn->removeFnAttr(llvm::Attribute::ReadNone);
-    Conv->setMemoryEffects(llvm::MemoryEffects::none());
+  IRBuilder<> Builder(InsertBefore);
+
+  Value *Cast = nullptr;
+  if (OldTy->isPointerTy() && NewTy->isPointerTy()) {
+    auto OldAS = OldTy->getPointerAddressSpace();
+    auto NewAS = NewTy->getPointerAddressSpace();
+    // Some frontends mix private and global pointers which is not allowed by
+    // SPIR-V. Using ptr->i64->ptr cast in this case to avoid failures until
+    // the frontends are fixed.
+    if (OldAS == NewAS || OldAS == SPIRVParams::SPIRVGenericAS ||
+        NewAS == SPIRVParams::SPIRVGenericAS) {
+      Cast = Builder.CreatePointerBitCastOrAddrSpaceCast(&NewArg, OldTy);
+    } else {
+      auto *Int64Ty = Builder.getInt64Ty();
+      auto *PToI = Builder.CreatePtrToInt(&NewArg, Int64Ty);
+      Cast = Builder.CreateIntToPtr(PToI, OldTy);
+    }
+  } else if (OldTy->isPointerTy() && NewTy->isIntegerTy()) {
+    Cast = Builder.CreateIntToPtr(&NewArg, OldTy);
+  } else if (OldTy->isIntegerTy() && NewTy->isPointerTy()) {
+    Cast = Builder.CreatePtrToInt(&NewArg, OldTy);
+  } else {
+    auto *M = OldArg.getParent()->getParent();
+    auto *ConvFn = GenXIntrinsic::getGenXDeclaration(
+        M, GenXIntrinsic::genx_address_convert, {OldTy, NewTy});
+    ConvFn->addFnAttr(VCFunctionMD::VCFunction);
+    Cast = Builder.CreateCall(ConvFn, {&NewArg});
   }
-#endif
-  OldArg.replaceAllUsesWith(Conv);
-  return Conv;
+
+  if (Cast)
+    OldArg.replaceAllUsesWith(Cast);
 }
 
 // Parse argument desc.
@@ -418,7 +516,7 @@
 //  }
 // will be changed to
 //  define spir_kernel @foo(%opencl.image2d_rw_t addrspace(1)* %im) {
-//    %conv = call @llvm.genx.address.convert(%im)
+//    %conv = ptrtoint %opencl.image2d_rw_t addrspace(1)* %im to i32
 //   ...
 //  }
 // Parameters that are not part of public interface (implicit arguments)
@@ -441,12 +539,8 @@
 #endif
 
   Instruction *InsPt = &NewF->getEntryBlock().front();
-  for (auto ArgPair : llvm::zip(F.args(), NewF->args())) {
-    Instruction *Convert =
-        rewriteArgumentUses(std::get<0>(ArgPair), std::get<1>(ArgPair));
-    if (Convert)
-      Convert->insertBefore(InsPt);
-  }
+  for (auto ArgPair : llvm::zip(F.args(), NewF->args()))
+    rewriteArgumentUses(InsPt, std::get<0>(ArgPair), std::get<1>(ArgPair));
 
   F.eraseFromParent();
 }
@@ -462,6 +556,20 @@
       rewriteKernelArguments(*F);
 }
 
+#if VC_INTR_LLVM_VERSION_MAJOR >= 16
+static inline void FixAttributes(Function &F, Attribute::AttrKind Attr,
+                                 MemoryEffects MemEf) {
+  if (F.getFnAttribute(Attr).isValid()) {
+    for (auto &U : F.uses()) {
+      if (auto *Call = dyn_cast<CallInst>(&*U)) {
+        Call->setMemoryEffects(MemEf);
+      }
+    }
+    F.removeFnAttr(Attr);
+  }
+}
+#endif
+
 bool GenXSPIRVWriterAdaptorImpl::run(Module &M) {
   auto TargetTriple = StringRef(M.getTargetTriple());
   if (TargetTriple.startswith("genx")) {
@@ -482,9 +590,8 @@
     }
   }
 
-
   for (auto &&F : M)
-      runOnFunction(F);
+    runOnFunction(F);
 
   // Old metadata is not needed anymore at this point.
   if (auto *MD = M.getNamedMetadata(FunctionMD::GenXKernels))
@@ -496,6 +603,18 @@
   if (RewriteSingleElementVectors)
     rewriteSingleElementVectors(M);
 
+#if VC_INTR_LLVM_VERSION_MAJOR >= 16
+  // ReadNone and ReadOnly is no more supported for intrinsics:
+  // https://reviews.llvm.org/D135780
+  for (auto &&F : M) {
+    FixAttributes(F, llvm::Attribute::ReadNone, llvm::MemoryEffects::none());
+    FixAttributes(F, llvm::Attribute::ReadOnly,
+                  llvm::MemoryEffects::readOnly());
+    FixAttributes(F, llvm::Attribute::WriteOnly,
+                  llvm::MemoryEffects::writeOnly());
+  }
+#endif
+
   return true;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/addr_conv_attribute_writer.ll
 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/addr_conv_attribute_writer.ll
--- 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/addr_conv_attribute_writer.ll
 2023-03-17 23:57:19.000000000 +0100
+++ 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/addr_conv_attribute_writer.ll
 2023-05-16 01:51:29.000000000 +0200
@@ -1,6 +1,6 @@
 ;=========================== begin_copyright_notice 
============================
 ;
-; Copyright (C) 2021-2022 Intel Corporation
+; Copyright (C) 2021-2023 Intel Corporation
 ;
 ; SPDX-License-Identifier: MIT
 ;
@@ -15,19 +15,15 @@
 ; CHECK: %intel.buffer_rw_t addrspace(1)*
 ; CHECK: [[BUF:%[^,]+]])
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TMP0:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1intel.buffer_rw_t(%intel.buffer_rw_t 
addrspace(1)* [[BUF]])
+; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint %intel.buffer_rw_t addrspace(1)* 
[[BUF]] to i32
 ; CHECK-NEXT:    ret void
 ;
 entry:
   ret void
 }
 
-; CHECK: declare !genx_intrinsic_id !{{[0-9]+}} i32 
@llvm.genx.address.convert.i32.p1intel.buffer_rw_t(%intel.buffer_rw_t 
addrspace(1)*) #[[ATTRS:[0-9]+]]
 !genx.kernels = !{!0}
 
-; CHECK: attributes #[[ATTRS]]
-; CHECK-SAME: "VCFunction"
-
 !0 = !{void (i32)* @test, !"test", !1, i32 0, i32 0, !2, !3, i32 0, i32 0}
 !1 = !{i32 2}
 !2 = !{i32 0}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/annot_mess_writer.ll 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/annot_mess_writer.ll
--- old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/annot_mess_writer.ll  
2023-03-17 23:57:19.000000000 +0100
+++ new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/annot_mess_writer.ll  
2023-05-16 01:51:29.000000000 +0200
@@ -1,6 +1,6 @@
 ;=========================== begin_copyright_notice 
============================
 ;
-; Copyright (C) 2020-2022 Intel Corporation
+; Copyright (C) 2020-2023 Intel Corporation
 ;
 ; SPDX-License-Identifier: MIT
 ;
@@ -35,9 +35,9 @@
 ; CHECK: [[GEN:%[^)]+]])
 
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TMP0:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1opencl.image2d_ro_t(%opencl.image2d_ro_t 
addrspace(1)* [[IM2D]])
-; CHECK-NEXT:    [[TMP1:%.*]] = call i32 
@llvm.genx.address.convert.i32.p2opencl.sampler_t(%opencl.sampler_t 
addrspace(2)* [[SAMP]])
-; CHECK-NEXT:    [[TMP2:%.*]] = call i64 
@llvm.genx.address.convert.i64.p1i8(i8 addrspace(1)* [[PTR:%.*]])
+; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint %opencl.image2d_ro_t addrspace(1)* 
[[IM2D]] to i32
+; CHECK-NEXT:    [[TMP1:%.*]] = ptrtoint %opencl.sampler_t addrspace(2)* 
[[SAMP]] to i32
+; CHECK-NEXT:    [[TMP2:%.*]] = ptrtoint i8 addrspace(1)* [[PTR:%.*]] to i64
 ; CHECK-NEXT:    ret void
 ;
 entry:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/annotated_args_writer.ll 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/annotated_args_writer.ll
--- 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/annotated_args_writer.ll  
    2023-03-17 23:57:19.000000000 +0100
+++ 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/annotated_args_writer.ll  
    2023-05-16 01:51:29.000000000 +0200
@@ -1,6 +1,6 @@
 ;=========================== begin_copyright_notice 
============================
 ;
-; Copyright (C) 2020-2022 Intel Corporation
+; Copyright (C) 2020-2023 Intel Corporation
 ;
 ; SPDX-License-Identifier: MIT
 ;
@@ -57,13 +57,13 @@
 ; CHECK: [[GEN:%[^)]+]])
 
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TMP0:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1intel.buffer_rw_t(%intel.buffer_rw_t 
addrspace(1)* [[BUF]])
-; CHECK-NEXT:    [[TMP1:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1opencl.image1d_rw_t(%opencl.image1d_rw_t 
addrspace(1)* [[IM1D]])
-; CHECK-NEXT:    [[TMP2:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1opencl.image1d_buffer_rw_t(%opencl.image1d_buffer_rw_t
 addrspace(1)* [[IM1DB]])
-; CHECK-NEXT:    [[TMP3:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1opencl.image2d_rw_t(%opencl.image2d_rw_t 
addrspace(1)* [[IM2D]])
-; CHECK-NEXT:    [[TMP4:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1opencl.image3d_rw_t(%opencl.image3d_rw_t 
addrspace(1)* [[IM3D]])
-; CHECK-NEXT:    [[TMP5:%.*]] = call i32 
@llvm.genx.address.convert.i32.p2opencl.sampler_t(%opencl.sampler_t 
addrspace(2)* [[SAMP]])
-; CHECK-NEXT:    [[TMP6:%.*]] = call i64 
@llvm.genx.address.convert.i64.p1i8(i8 addrspace(1)* [[PTR]])
+; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint %intel.buffer_rw_t addrspace(1)* 
[[BUF]] to i32
+; CHECK-NEXT:    [[TMP1:%.*]] = ptrtoint %opencl.image1d_rw_t addrspace(1)* 
[[IM1D]] to i32
+; CHECK-NEXT:    [[TMP2:%.*]] = ptrtoint %opencl.image1d_buffer_rw_t 
addrspace(1)* [[IM1DB]] to i32
+; CHECK-NEXT:    [[TMP3:%.*]] = ptrtoint %opencl.image2d_rw_t addrspace(1)* 
[[IM2D]] to i32
+; CHECK-NEXT:    [[TMP4:%.*]] = ptrtoint %opencl.image3d_rw_t addrspace(1)* 
[[IM3D]] to i32
+; CHECK-NEXT:    [[TMP5:%.*]] = ptrtoint %opencl.sampler_t addrspace(2)* 
[[SAMP]] to i32
+; CHECK-NEXT:    [[TMP6:%.*]] = ptrtoint i8 addrspace(1)* [[PTR]] to i64
 ; CHECK-NEXT:    ret void
 ;
 entry:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/args_attributes_transform_writer.ll
 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/args_attributes_transform_writer.ll
--- 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/args_attributes_transform_writer.ll
   2023-03-17 23:57:19.000000000 +0100
+++ 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/args_attributes_transform_writer.ll
   2023-05-16 01:51:29.000000000 +0200
@@ -1,6 +1,6 @@
 ;=========================== begin_copyright_notice 
============================
 ;
-; Copyright (C) 2021-2022 Intel Corporation
+; Copyright (C) 2021-2023 Intel Corporation
 ;
 ; SPDX-License-Identifier: MIT
 ;
@@ -11,9 +11,8 @@
 ; UNSUPPORTED: llvm8
 ; RUN: opt %pass%GenXSPIRVWriterAdaptor -S < %s | FileCheck %s
 ; CHECK: @test
-; CHECK-SAME: i8
-; CHECK-SAME: byval(i8)
-; CHECK-SAME: arg
+; CHECK-SAME: %foo addrspace(1)* byval(%foo)
+; CHECK-SAME: %arg
 
 %foo = type { i32 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/combined_args_writer.ll 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/combined_args_writer.ll
--- 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/combined_args_writer.ll   
    2023-03-17 23:57:19.000000000 +0100
+++ 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/combined_args_writer.ll   
    2023-05-16 01:51:29.000000000 +0200
@@ -1,6 +1,6 @@
 ;=========================== begin_copyright_notice 
============================
 ;
-; Copyright (C) 2020-2022 Intel Corporation
+; Copyright (C) 2020-2023 Intel Corporation
 ;
 ; SPDX-License-Identifier: MIT
 ;
@@ -31,8 +31,8 @@
 ; CHECK: [[LOCAL_ID:%[^)]+]])
 
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TMP0:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1opencl.image2d_ro_t(%opencl.image2d_ro_t 
addrspace(1)* [[IN]])
-; CHECK-NEXT:    [[TMP1:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1opencl.image2d_wo_t(%opencl.image2d_wo_t 
addrspace(1)* [[OUT]])
+; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint %opencl.image2d_ro_t addrspace(1)* 
[[IN]] to i32
+; CHECK-NEXT:    [[TMP1:%.*]] = ptrtoint %opencl.image2d_wo_t addrspace(1)* 
[[OUT]] to i32
 ; CHECK-NEXT:    [[TMP2:%.*]] = extractelement <3 x i32> [[LOCAL_ID]], i32 0
 ; CHECK-NEXT:    [[CALL1_I_I_I:%.*]] = tail call <8 x i32> 
@llvm.genx.media.ld.v8i32(i32 0, i32 [[TMP0]], i32 0, i32 32, i32 [[TMP2]], i32 
0)
 ; CHECK-NEXT:    tail call void @llvm.genx.media.st.v8i32(i32 0, i32 [[TMP1]], 
i32 0, i32 32, i32 [[TMP2]], i32 0, <8 x i32> [[CALL1_I_I_I]])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/image_array_writer.ll 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/image_array_writer.ll
--- old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/image_array_writer.ll 
2023-03-17 23:57:19.000000000 +0100
+++ new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/image_array_writer.ll 
2023-05-16 01:51:29.000000000 +0200
@@ -1,6 +1,6 @@
 ;=========================== begin_copyright_notice 
============================
 ;
-; Copyright (C) 2021-2022 Intel Corporation
+; Copyright (C) 2021-2023 Intel Corporation
 ;
 ; SPDX-License-Identifier: MIT
 ;
@@ -20,8 +20,8 @@
 ; CHECK: [[IM2D:%[^)]+]])
 
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TMP0:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1opencl.image1d_array_ro_t(%opencl.image1d_array_ro_t
 addrspace(1)* [[IM1D]])
-; CHECK-NEXT:    [[TMP1:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1opencl.image2d_array_wo_t(%opencl.image2d_array_wo_t
 addrspace(1)* [[IM2D]])
+; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint %opencl.image1d_array_ro_t 
addrspace(1)* [[IM1D]] to i32
+; CHECK-NEXT:    [[TMP1:%.*]] = ptrtoint %opencl.image2d_array_wo_t 
addrspace(1)* [[IM2D]] to i32
 ; CHECK-NEXT:     ret void
 ;
 entry:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/media_block_writer.ll 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/media_block_writer.ll
--- old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/media_block_writer.ll 
2023-03-17 23:57:19.000000000 +0100
+++ new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/media_block_writer.ll 
2023-05-16 01:51:29.000000000 +0200
@@ -1,6 +1,6 @@
 ;=========================== begin_copyright_notice 
============================
 ;
-; Copyright (C) 2021-2022 Intel Corporation
+; Copyright (C) 2021-2023 Intel Corporation
 ;
 ; SPDX-License-Identifier: MIT
 ;
@@ -17,7 +17,7 @@
 ; CHECK: [[IMAGE:%[^)]+]])
 
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TMP0:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1intel.image2d_media_block_ro_t(%intel.image2d_media_block_ro_t
 addrspace(1)* [[IMAGE]])
+; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint %intel.image2d_media_block_ro_t 
addrspace(1)* [[IMAGE]] to i32
 ; CHECK-NEXT:    ret void
 ;
 entry:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/plain_args_writer.ll 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/plain_args_writer.ll
--- old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/plain_args_writer.ll  
2023-03-17 23:57:19.000000000 +0100
+++ new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/plain_args_writer.ll  
2023-05-16 01:51:29.000000000 +0200
@@ -1,6 +1,6 @@
 ;=========================== begin_copyright_notice 
============================
 ;
-; Copyright (C) 2020-2022 Intel Corporation
+; Copyright (C) 2020-2023 Intel Corporation
 ;
 ; SPDX-License-Identifier: MIT
 ;
@@ -37,8 +37,8 @@
 ; CHECK: [[GEN:%[^)]+]])
 
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TMP0:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1intel.buffer_rw_t(%intel.buffer_rw_t 
addrspace(1)* [[SURF]])
-; CHECK-NEXT:    [[TMP1:%.*]] = call i32 
@llvm.genx.address.convert.i32.p2opencl.sampler_t(%opencl.sampler_t 
addrspace(2)* [[SAMP]])
+; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint %intel.buffer_rw_t addrspace(1)* 
[[SURF]] to i32
+; CHECK-NEXT:    [[TMP1:%.*]] = ptrtoint %opencl.sampler_t addrspace(2)* 
[[SAMP]] to i32
 ; CHECK-NEXT:    ret void
 ;
 entry:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/sev_signature_reader.ll 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/sev_signature_reader.ll
--- 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/sev_signature_reader.ll   
    2023-03-17 23:57:19.000000000 +0100
+++ 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/sev_signature_reader.ll   
    2023-05-16 01:51:29.000000000 +0200
@@ -1,6 +1,6 @@
 ;=========================== begin_copyright_notice 
============================
 ;
-; Copyright (C) 2020-2022 Intel Corporation
+; Copyright (C) 2020-2023 Intel Corporation
 ;
 ; SPDX-License-Identifier: MIT
 ;
@@ -10,7 +10,6 @@
 
 ; LLVM16 error: symbol with local linkage cannot have a DLL storage class 
 ; for test-function (internal dllexport)
-; XFAIL: llvm16
 ; RUN: opt %pass%GenXSPIRVReaderAdaptor -S < %s | FileCheck %s
 
 ; CHECK: @global_var_0 = internal global <1 x i32> undef, align 4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/surface_access_writer.ll 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/surface_access_writer.ll
--- 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/Adaptors/surface_access_writer.ll  
    2023-03-17 23:57:19.000000000 +0100
+++ 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/Adaptors/surface_access_writer.ll  
    2023-05-16 01:51:29.000000000 +0200
@@ -1,6 +1,6 @@
 ;=========================== begin_copyright_notice 
============================
 ;
-; Copyright (C) 2020-2022 Intel Corporation
+; Copyright (C) 2020-2023 Intel Corporation
 ;
 ; SPDX-License-Identifier: MIT
 ;
@@ -41,11 +41,11 @@
 ; CHECK: [[IM3D:%[^)]+]])
 
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TMP0:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1intel.buffer_ro_t(%intel.buffer_ro_t 
addrspace(1)* [[BUF]])
-; CHECK-NEXT:    [[TMP1:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1opencl.image1d_rw_t(%opencl.image1d_rw_t 
addrspace(1)* [[IM1D]])
-; CHECK-NEXT:    [[TMP2:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1opencl.image1d_buffer_wo_t(%opencl.image1d_buffer_wo_t
 addrspace(1)* [[IM1DB]])
-; CHECK-NEXT:    [[TMP3:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1opencl.image2d_wo_t(%opencl.image2d_wo_t 
addrspace(1)* [[IM2D]])
-; CHECK-NEXT:    [[TMP4:%.*]] = call i32 
@llvm.genx.address.convert.i32.p1opencl.image3d_ro_t(%opencl.image3d_ro_t 
addrspace(1)* [[IM3D]])
+; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint %intel.buffer_ro_t addrspace(1)* 
[[BUF]] to i32
+; CHECK-NEXT:    [[TMP1:%.*]] = ptrtoint %opencl.image1d_rw_t addrspace(1)* 
[[IM1D]] to i32
+; CHECK-NEXT:    [[TMP2:%.*]] = ptrtoint %opencl.image1d_buffer_wo_t 
addrspace(1)* [[IM1DB]] to i32
+; CHECK-NEXT:    [[TMP3:%.*]] = ptrtoint %opencl.image2d_wo_t addrspace(1)* 
[[IM2D]] to i32
+; CHECK-NEXT:    [[TMP4:%.*]] = ptrtoint %opencl.image3d_ro_t addrspace(1)* 
[[IM3D]] to i32
 ; CHECK-NEXT:    ret void
 ;
 entry:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/SimdCFLowering/bitcast_between_wrrs.ll
 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/SimdCFLowering/bitcast_between_wrrs.ll
--- 
old/vc-intrinsics-0.12.3/GenXIntrinsics/test/SimdCFLowering/bitcast_between_wrrs.ll
 2023-03-17 23:57:19.000000000 +0100
+++ 
new/vc-intrinsics-0.13.0/GenXIntrinsics/test/SimdCFLowering/bitcast_between_wrrs.ll
 2023-05-16 01:51:29.000000000 +0200
@@ -1,12 +1,11 @@
 ;=========================== begin_copyright_notice 
============================
 ;
-; Copyright (C) 2020-2022 Intel Corporation
+; Copyright (C) 2020-2023 Intel Corporation
 ;
 ; SPDX-License-Identifier: MIT
 ;
 ;============================ end_copyright_notice 
=============================
 
-; XFAIL: llvm16
 ; RUN: opt %pass%cmsimdcflowering -S < %s | FileCheck %s
 
 @Rcp_T2 = internal global <64 x double> undef
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vc-intrinsics-0.12.3/LICENSE.md 
new/vc-intrinsics-0.13.0/LICENSE.md
--- old/vc-intrinsics-0.12.3/LICENSE.md 1970-01-01 01:00:00.000000000 +0100
+++ new/vc-intrinsics-0.13.0/LICENSE.md 2023-05-16 01:51:29.000000000 +0200
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 Intel Corporation
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vc-intrinsics-0.12.3/SECURITY.md 
new/vc-intrinsics-0.13.0/SECURITY.md
--- old/vc-intrinsics-0.12.3/SECURITY.md        1970-01-01 01:00:00.000000000 
+0100
+++ new/vc-intrinsics-0.13.0/SECURITY.md        2023-05-16 01:51:29.000000000 
+0200
@@ -0,0 +1,5 @@
+# Security Policy
+Intel is committed to rapidly addressing security vulnerabilities affecting 
our customers and providing clear guidance on the solution, impact, severity 
and mitigation.
+
+## Reporting a Vulnerability
+Please report any security vulnerabilities in this project [utilizing the 
guidelines 
here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html).

Reply via email to