Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[SPIRV] Add explicit layout #135789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 5, 2025
Merged

[SPIRV] Add explicit layout #135789

merged 8 commits into from
May 5, 2025

Conversation

s-perron
Copy link
Contributor

@s-perron s-perron commented Apr 15, 2025

Adds code to add offset decorations when needed. This could cause a
type mismatch for memory instructions. We add code to fix up OpLoad
instructions, so that we could get some tests. Other memory operations
will be handled in another PR.

Part of #134119.

Adds code add offset decorations when needed. This could cause a
type mismatch for memory instructions. We add code to fix up OpLoad
instructions, so that we could get some tests. Other memory operations
will be handled in another PR.

Part of llvm#134119.
@llvmbot
Copy link
Member

llvmbot commented Apr 15, 2025

@llvm/pr-subscribers-backend-spir-v

Author: Steven Perron (s-perron)

Changes

Adds code add offset decorations when needed. This could cause a
type mismatch for memory instructions. We add code to fix up OpLoad
instructions, so that we could get some tests. Other memory operations
will be handled in another PR.

Part of #134119.


Patch is 45.83 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/135789.diff

7 Files Affected:

  • (modified) llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp (+162-103)
  • (modified) llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h (+26-9)
  • (modified) llvm/lib/Target/SPIRV/SPIRVIRMapping.h (+50-5)
  • (modified) llvm/lib/Target/SPIRV/SPIRVISelLowering.cpp (+95)
  • (modified) llvm/lib/Target/SPIRV/SPIRVISelLowering.h (+5)
  • (modified) llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll (+6-5)
  • (added) llvm/test/CodeGen/SPIRV/spirv-explicit-layout.ll (+123)
diff --git a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
index 4ce316ea32e1c..2655167abe6af 100644
--- a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
@@ -835,13 +835,31 @@ static std::string buildSpirvTypeName(const SPIRVType *Type,
   }
   case SPIRV::OpTypeStruct: {
     std::string TypeName = "{";
-    for (uint32_t I = 2; I < Type->getNumOperands(); ++I) {
+    for (uint32_t I = 1; I < Type->getNumOperands(); ++I) {
       SPIRVType *MemberType =
           GR.getSPIRVTypeForVReg(Type->getOperand(I).getReg());
-      TypeName = '_' + buildSpirvTypeName(MemberType, MIRBuilder, GR);
+      TypeName += '_' + buildSpirvTypeName(MemberType, MIRBuilder, GR);
     }
     return TypeName + "}";
   }
+  case SPIRV::OpTypeVector: {
+    MachineRegisterInfo *MRI = MIRBuilder.getMRI();
+    Register ElementTypeReg = Type->getOperand(1).getReg();
+    auto *ElementType = MRI->getUniqueVRegDef(ElementTypeReg);
+    uint32_t VectorSize = GR.getScalarOrVectorComponentCount(Type);
+    return (buildSpirvTypeName(ElementType, MIRBuilder, GR) + Twine("[") +
+            Twine(VectorSize) + Twine("]"))
+        .str();
+  }
+  case SPIRV::OpTypeRuntimeArray: {
+    MachineRegisterInfo *MRI = MIRBuilder.getMRI();
+    Register ElementTypeReg = Type->getOperand(1).getReg();
+    auto *ElementType = MRI->getUniqueVRegDef(ElementTypeReg);
+    uint32_t ArraySize = 0;
+    return (buildSpirvTypeName(ElementType, MIRBuilder, GR) + Twine("[") +
+            Twine(ArraySize) + Twine("]"))
+        .str();
+  }
   default:
     llvm_unreachable("Trying to the the name of an unknown type.");
   }
@@ -883,30 +901,41 @@ Register SPIRVGlobalRegistry::getOrCreateGlobalVariableWithBinding(
   return VarReg;
 }
 
+// TODO: Double check the calls to getOpTypeArray to make sure that `ElemType`
+// is explicitly laid out when required.
 SPIRVType *SPIRVGlobalRegistry::getOpTypeArray(uint32_t NumElems,
                                                SPIRVType *ElemType,
                                                MachineIRBuilder &MIRBuilder,
+                                               bool ExplicitLayoutRequired,
                                                bool EmitIR) {
   assert((ElemType->getOpcode() != SPIRV::OpTypeVoid) &&
          "Invalid array element type");
   SPIRVType *SpvTypeInt32 = getOrCreateSPIRVIntegerType(32, MIRBuilder);
-
+  SPIRVType *ArrayType = nullptr;
   if (NumElems != 0) {
     Register NumElementsVReg =
         buildConstantInt(NumElems, MIRBuilder, SpvTypeInt32, EmitIR);
-    return createOpType(MIRBuilder, [&](MachineIRBuilder &MIRBuilder) {
+    ArrayType = createOpType(MIRBuilder, [&](MachineIRBuilder &MIRBuilder) {
       return MIRBuilder.buildInstr(SPIRV::OpTypeArray)
           .addDef(createTypeVReg(MIRBuilder))
           .addUse(getSPIRVTypeID(ElemType))
           .addUse(NumElementsVReg);
     });
+  } else {
+    ArrayType = createOpType(MIRBuilder, [&](MachineIRBuilder &MIRBuilder) {
+      return MIRBuilder.buildInstr(SPIRV::OpTypeRuntimeArray)
+          .addDef(createTypeVReg(MIRBuilder))
+          .addUse(getSPIRVTypeID(ElemType));
+    });
   }
 
-  return createOpType(MIRBuilder, [&](MachineIRBuilder &MIRBuilder) {
-    return MIRBuilder.buildInstr(SPIRV::OpTypeRuntimeArray)
-        .addDef(createTypeVReg(MIRBuilder))
-        .addUse(getSPIRVTypeID(ElemType));
-  });
+  if (ExplicitLayoutRequired) {
+    Type *ET = const_cast<Type *>(getTypeForSPIRVType(ElemType));
+    addArrayStrideDecorations(ArrayType->defs().begin()->getReg(), ET,
+                              MIRBuilder);
+  }
+
+  return ArrayType;
 }
 
 SPIRVType *SPIRVGlobalRegistry::getOpTypeOpaque(const StructType *Ty,
@@ -924,7 +953,8 @@ SPIRVType *SPIRVGlobalRegistry::getOpTypeOpaque(const StructType *Ty,
 
 SPIRVType *SPIRVGlobalRegistry::getOpTypeStruct(
     const StructType *Ty, MachineIRBuilder &MIRBuilder,
-    SPIRV::AccessQualifier::AccessQualifier AccQual, bool EmitIR) {
+    SPIRV::AccessQualifier::AccessQualifier AccQual,
+    bool ExplicitLayoutRequired, bool EmitIR) {
   SmallVector<Register, 4> FieldTypes;
   constexpr unsigned MaxWordCount = UINT16_MAX;
   const size_t NumElements = Ty->getNumElements();
@@ -938,8 +968,8 @@ SPIRVType *SPIRVGlobalRegistry::getOpTypeStruct(
   }
 
   for (const auto &Elem : Ty->elements()) {
-    SPIRVType *ElemTy =
-        findSPIRVType(toTypedPointer(Elem), MIRBuilder, AccQual, EmitIR);
+    SPIRVType *ElemTy = findSPIRVType(toTypedPointer(Elem), MIRBuilder, AccQual,
+                                      ExplicitLayoutRequired, EmitIR);
     assert(ElemTy && ElemTy->getOpcode() != SPIRV::OpTypeVoid &&
            "Invalid struct element type");
     FieldTypes.push_back(getSPIRVTypeID(ElemTy));
@@ -950,18 +980,27 @@ SPIRVType *SPIRVGlobalRegistry::getOpTypeStruct(
   if (Ty->isPacked())
     buildOpDecorate(ResVReg, MIRBuilder, SPIRV::Decoration::CPacked, {});
 
-  return createOpType(MIRBuilder, [&](MachineIRBuilder &MIRBuilder) {
-    auto MIBStruct = MIRBuilder.buildInstr(SPIRV::OpTypeStruct).addDef(ResVReg);
-    for (size_t I = 0; I < SPIRVStructNumElements; ++I)
-      MIBStruct.addUse(FieldTypes[I]);
-    for (size_t I = SPIRVStructNumElements; I < NumElements;
-         I += MaxNumElements) {
-      auto MIBCont = MIRBuilder.buildInstr(SPIRV::OpTypeStructContinuedINTEL);
-      for (size_t J = I; J < std::min(I + MaxNumElements, NumElements); ++J)
-        MIBCont.addUse(FieldTypes[I]);
-    }
-    return MIBStruct;
-  });
+  SPIRVType *SPVType =
+      createOpType(MIRBuilder, [&](MachineIRBuilder &MIRBuilder) {
+        auto MIBStruct =
+            MIRBuilder.buildInstr(SPIRV::OpTypeStruct).addDef(ResVReg);
+        for (size_t I = 0; I < SPIRVStructNumElements; ++I)
+          MIBStruct.addUse(FieldTypes[I]);
+        for (size_t I = SPIRVStructNumElements; I < NumElements;
+             I += MaxNumElements) {
+          auto MIBCont =
+              MIRBuilder.buildInstr(SPIRV::OpTypeStructContinuedINTEL);
+          for (size_t J = I; J < std::min(I + MaxNumElements, NumElements); ++J)
+            MIBCont.addUse(FieldTypes[I]);
+        }
+        return MIBStruct;
+      });
+
+  if (ExplicitLayoutRequired)
+    addStructOffsetDecorations(SPVType->defs().begin()->getReg(),
+                               const_cast<StructType *>(Ty), MIRBuilder);
+
+  return SPVType;
 }
 
 SPIRVType *SPIRVGlobalRegistry::getOrCreateSpecialType(
@@ -1011,22 +1050,26 @@ SPIRVType *SPIRVGlobalRegistry::getOrCreateOpTypeFunctionWithArgs(
     const Type *Ty, SPIRVType *RetType,
     const SmallVectorImpl<SPIRVType *> &ArgTypes,
     MachineIRBuilder &MIRBuilder) {
-  if (const MachineInstr *MI = findMI(Ty, &MIRBuilder.getMF()))
+  if (const MachineInstr *MI = findMI(Ty, false, &MIRBuilder.getMF()))
     return MI;
   const MachineInstr *NewMI = getOpTypeFunction(RetType, ArgTypes, MIRBuilder);
-  add(Ty, NewMI);
+  add(Ty, false, NewMI);
   return finishCreatingSPIRVType(Ty, NewMI);
 }
 
 SPIRVType *SPIRVGlobalRegistry::findSPIRVType(
     const Type *Ty, MachineIRBuilder &MIRBuilder,
-    SPIRV::AccessQualifier::AccessQualifier AccQual, bool EmitIR) {
+    SPIRV::AccessQualifier::AccessQualifier AccQual,
+    bool ExplicitLayoutRequired, bool EmitIR) {
   Ty = adjustIntTypeByWidth(Ty);
-  if (const MachineInstr *MI = findMI(Ty, &MIRBuilder.getMF()))
+  // TODO: findMI needs to know if a layout is required.
+  if (const MachineInstr *MI =
+          findMI(Ty, ExplicitLayoutRequired, &MIRBuilder.getMF()))
     return MI;
   if (auto It = ForwardPointerTypes.find(Ty); It != ForwardPointerTypes.end())
     return It->second;
-  return restOfCreateSPIRVType(Ty, MIRBuilder, AccQual, EmitIR);
+  return restOfCreateSPIRVType(Ty, MIRBuilder, AccQual, ExplicitLayoutRequired,
+                               EmitIR);
 }
 
 Register SPIRVGlobalRegistry::getSPIRVTypeID(const SPIRVType *SpirvType) const {
@@ -1060,11 +1103,13 @@ const Type *SPIRVGlobalRegistry::adjustIntTypeByWidth(const Type *Ty) const {
 
 SPIRVType *SPIRVGlobalRegistry::createSPIRVType(
     const Type *Ty, MachineIRBuilder &MIRBuilder,
-    SPIRV::AccessQualifier::AccessQualifier AccQual, bool EmitIR) {
+    SPIRV::AccessQualifier::AccessQualifier AccQual,
+    bool ExplicitLayoutRequired, bool EmitIR) {
   if (isSpecialOpaqueType(Ty))
     return getOrCreateSpecialType(Ty, MIRBuilder, AccQual);
 
-  if (const MachineInstr *MI = findMI(Ty, &MIRBuilder.getMF()))
+  if (const MachineInstr *MI =
+          findMI(Ty, ExplicitLayoutRequired, &MIRBuilder.getMF()))
     return MI;
 
   if (auto IType = dyn_cast<IntegerType>(Ty)) {
@@ -1077,27 +1122,31 @@ SPIRVType *SPIRVGlobalRegistry::createSPIRVType(
   if (Ty->isVoidTy())
     return getOpTypeVoid(MIRBuilder);
   if (Ty->isVectorTy()) {
-    SPIRVType *El = findSPIRVType(cast<FixedVectorType>(Ty)->getElementType(),
-                                  MIRBuilder, AccQual, EmitIR);
+    SPIRVType *El =
+        findSPIRVType(cast<FixedVectorType>(Ty)->getElementType(), MIRBuilder,
+                      AccQual, ExplicitLayoutRequired, EmitIR);
     return getOpTypeVector(cast<FixedVectorType>(Ty)->getNumElements(), El,
                            MIRBuilder);
   }
   if (Ty->isArrayTy()) {
-    SPIRVType *El =
-        findSPIRVType(Ty->getArrayElementType(), MIRBuilder, AccQual, EmitIR);
-    return getOpTypeArray(Ty->getArrayNumElements(), El, MIRBuilder, EmitIR);
+    SPIRVType *El = findSPIRVType(Ty->getArrayElementType(), MIRBuilder,
+                                  AccQual, ExplicitLayoutRequired, EmitIR);
+    return getOpTypeArray(Ty->getArrayNumElements(), El, MIRBuilder,
+                          ExplicitLayoutRequired, EmitIR);
   }
   if (auto SType = dyn_cast<StructType>(Ty)) {
     if (SType->isOpaque())
       return getOpTypeOpaque(SType, MIRBuilder);
-    return getOpTypeStruct(SType, MIRBuilder, AccQual, EmitIR);
+    return getOpTypeStruct(SType, MIRBuilder, AccQual, ExplicitLayoutRequired,
+                           EmitIR);
   }
   if (auto FType = dyn_cast<FunctionType>(Ty)) {
-    SPIRVType *RetTy =
-        findSPIRVType(FType->getReturnType(), MIRBuilder, AccQual, EmitIR);
+    SPIRVType *RetTy = findSPIRVType(FType->getReturnType(), MIRBuilder,
+                                     AccQual, ExplicitLayoutRequired, EmitIR);
     SmallVector<SPIRVType *, 4> ParamTypes;
     for (const auto &ParamTy : FType->params())
-      ParamTypes.push_back(findSPIRVType(ParamTy, MIRBuilder, AccQual, EmitIR));
+      ParamTypes.push_back(findSPIRVType(ParamTy, MIRBuilder, AccQual,
+                                         ExplicitLayoutRequired, EmitIR));
     return getOpTypeFunction(RetTy, ParamTypes, MIRBuilder);
   }
 
@@ -1112,44 +1161,50 @@ SPIRVType *SPIRVGlobalRegistry::createSPIRVType(
   const SPIRVSubtarget *ST =
       static_cast<const SPIRVSubtarget *>(&MIRBuilder.getMF().getSubtarget());
   auto SC = addressSpaceToStorageClass(AddrSpace, *ST);
-  // Null pointer means we have a loop in type definitions, make and
-  // return corresponding OpTypeForwardPointer.
-  if (SpvElementType == nullptr) {
-    auto [It, Inserted] = ForwardPointerTypes.try_emplace(Ty);
-    if (Inserted)
-      It->second = getOpTypeForwardPointer(SC, MIRBuilder);
-    return It->second;
+
+  Type *ElemTy = ::getPointeeType(Ty);
+  if (!ElemTy) {
+    ElemTy = Type::getInt8Ty(MIRBuilder.getContext());
   }
+
   // If we have forward pointer associated with this type, use its register
   // operand to create OpTypePointer.
   if (auto It = ForwardPointerTypes.find(Ty); It != ForwardPointerTypes.end()) {
     Register Reg = getSPIRVTypeID(It->second);
+    // TODO: what does getOpTypePointer do?
     return getOpTypePointer(SC, SpvElementType, MIRBuilder, Reg);
   }
 
-  return getOrCreateSPIRVPointerType(SpvElementType, MIRBuilder, SC);
+  return getOrCreateSPIRVPointerType(ElemTy, MIRBuilder, SC);
 }
 
 SPIRVType *SPIRVGlobalRegistry::restOfCreateSPIRVType(
     const Type *Ty, MachineIRBuilder &MIRBuilder,
-    SPIRV::AccessQualifier::AccessQualifier AccessQual, bool EmitIR) {
+    SPIRV::AccessQualifier::AccessQualifier AccessQual,
+    bool ExplicitLayoutRequired, bool EmitIR) {
+  // TODO: Could this create a problem if one requires an explicit layout, and
+  // the next time it does not?
   if (TypesInProcessing.count(Ty) && !isPointerTyOrWrapper(Ty))
     return nullptr;
   TypesInProcessing.insert(Ty);
-  SPIRVType *SpirvType = createSPIRVType(Ty, MIRBuilder, AccessQual, EmitIR);
+  SPIRVType *SpirvType = createSPIRVType(Ty, MIRBuilder, AccessQual,
+                                         ExplicitLayoutRequired, EmitIR);
   TypesInProcessing.erase(Ty);
   VRegToTypeMap[&MIRBuilder.getMF()][getSPIRVTypeID(SpirvType)] = SpirvType;
+
+  // TODO: We could end up with two SPIR-V types pointing to the same llvm type.
+  // Is that a problem?
   SPIRVToLLVMType[SpirvType] = unifyPtrType(Ty);
 
   if (SpirvType->getOpcode() == SPIRV::OpTypeForwardPointer ||
-      findMI(Ty, &MIRBuilder.getMF()) || isSpecialOpaqueType(Ty))
+      findMI(Ty, false, &MIRBuilder.getMF()) || isSpecialOpaqueType(Ty))
     return SpirvType;
 
   if (auto *ExtTy = dyn_cast<TargetExtType>(Ty);
       ExtTy && isTypedPointerWrapper(ExtTy))
     add(ExtTy->getTypeParameter(0), ExtTy->getIntParameter(0), SpirvType);
   else if (!isPointerTy(Ty))
-    add(Ty, SpirvType);
+    add(Ty, ExplicitLayoutRequired, SpirvType);
   else if (isTypedPointerTy(Ty))
     add(cast<TypedPointerType>(Ty)->getElementType(),
         getPointerAddressSpace(Ty), SpirvType);
@@ -1181,14 +1236,15 @@ SPIRVType *SPIRVGlobalRegistry::getResultType(Register VReg,
 
 SPIRVType *SPIRVGlobalRegistry::getOrCreateSPIRVType(
     const Type *Ty, MachineIRBuilder &MIRBuilder,
-    SPIRV::AccessQualifier::AccessQualifier AccessQual, bool EmitIR) {
+    SPIRV::AccessQualifier::AccessQualifier AccessQual,
+    bool ExplicitLayoutRequired, bool EmitIR) {
   const MachineFunction *MF = &MIRBuilder.getMF();
   Register Reg;
   if (auto *ExtTy = dyn_cast<TargetExtType>(Ty);
       ExtTy && isTypedPointerWrapper(ExtTy))
     Reg = find(ExtTy->getTypeParameter(0), ExtTy->getIntParameter(0), MF);
   else if (!isPointerTy(Ty))
-    Reg = find(Ty = adjustIntTypeByWidth(Ty), MF);
+    Reg = find(Ty = adjustIntTypeByWidth(Ty), ExplicitLayoutRequired, MF);
   else if (isTypedPointerTy(Ty))
     Reg = find(cast<TypedPointerType>(Ty)->getElementType(),
                getPointerAddressSpace(Ty), MF);
@@ -1199,15 +1255,20 @@ SPIRVType *SPIRVGlobalRegistry::getOrCreateSPIRVType(
     return getSPIRVTypeForVReg(Reg);
 
   TypesInProcessing.clear();
-  SPIRVType *STy = restOfCreateSPIRVType(Ty, MIRBuilder, AccessQual, EmitIR);
+  SPIRVType *STy = restOfCreateSPIRVType(Ty, MIRBuilder, AccessQual,
+                                         ExplicitLayoutRequired, EmitIR);
   // Create normal pointer types for the corresponding OpTypeForwardPointers.
   for (auto &CU : ForwardPointerTypes) {
+    // Pointer type themselves do not require an explicit layout. The types
+    // they pointer to might, but that is taken care of when creating the type.
+    bool PtrNeedsLayout = false;
     const Type *Ty2 = CU.first;
     SPIRVType *STy2 = CU.second;
-    if ((Reg = find(Ty2, MF)).isValid())
+    if ((Reg = find(Ty2, PtrNeedsLayout, MF)).isValid())
       STy2 = getSPIRVTypeForVReg(Reg);
     else
-      STy2 = restOfCreateSPIRVType(Ty2, MIRBuilder, AccessQual, EmitIR);
+      STy2 = restOfCreateSPIRVType(Ty2, MIRBuilder, AccessQual, PtrNeedsLayout,
+                                   EmitIR);
     if (Ty == Ty2)
       STy = STy2;
   }
@@ -1360,16 +1421,16 @@ SPIRVType *SPIRVGlobalRegistry::getOrCreateVulkanBufferType(
   if (const MachineInstr *MI = findMI(Key, &MIRBuilder.getMF()))
     return MI;
 
-  // TODO(134119): The SPIRVType for `ElemType` will not have an explicit
-  // layout. This generates invalid SPIR-V.
+  bool ExplicitLayoutRequired = storageClassRequiresExplictLayout(SC);
+  // We need to get the SPIR-V type for the element here, so we can add the
+  // decoration to it.
   auto *T = StructType::create(ElemType);
   auto *BlockType =
-      getOrCreateSPIRVType(T, MIRBuilder, SPIRV::AccessQualifier::None, EmitIr);
+      getOrCreateSPIRVType(T, MIRBuilder, SPIRV::AccessQualifier::None,
+                           ExplicitLayoutRequired, EmitIr);
 
   buildOpDecorate(BlockType->defs().begin()->getReg(), MIRBuilder,
                   SPIRV::Decoration::Block, {});
-  buildOpMemberDecorate(BlockType->defs().begin()->getReg(), MIRBuilder,
-                        SPIRV::Decoration::Offset, 0, {0});
 
   if (!IsWritable) {
     buildOpMemberDecorate(BlockType->defs().begin()->getReg(), MIRBuilder,
@@ -1478,7 +1539,8 @@ SPIRVType *SPIRVGlobalRegistry::getOrCreateOpTypeCoopMatr(
     MachineIRBuilder &MIRBuilder, const TargetExtType *ExtensionType,
     const SPIRVType *ElemType, uint32_t Scope, uint32_t Rows, uint32_t Columns,
     uint32_t Use, bool EmitIR) {
-  if (const MachineInstr *MI = findMI(ExtensionType, &MIRBuilder.getMF()))
+  if (const MachineInstr *MI =
+          findMI(ExtensionType, false, &MIRBuilder.getMF()))
     return MI;
   const MachineInstr *NewMI =
       createOpType(MIRBuilder, [&](MachineIRBuilder &MIRBuilder) {
@@ -1491,26 +1553,26 @@ SPIRVType *SPIRVGlobalRegistry::getOrCreateOpTypeCoopMatr(
             .addUse(buildConstantInt(Columns, MIRBuilder, SpvTypeInt32, EmitIR))
             .addUse(buildConstantInt(Use, MIRBuilder, SpvTypeInt32, EmitIR));
       });
-  add(ExtensionType, NewMI);
+  add(ExtensionType, false, NewMI);
   return NewMI;
 }
 
 SPIRVType *SPIRVGlobalRegistry::getOrCreateOpTypeByOpcode(
     const Type *Ty, MachineIRBuilder &MIRBuilder, unsigned Opcode) {
-  if (const MachineInstr *MI = findMI(Ty, &MIRBuilder.getMF()))
+  if (const MachineInstr *MI = findMI(Ty, false, &MIRBuilder.getMF()))
     return MI;
   const MachineInstr *NewMI =
       createOpType(MIRBuilder, [&](MachineIRBuilder &MIRBuilder) {
         return MIRBuilder.buildInstr(Opcode).addDef(createTypeVReg(MIRBuilder));
       });
-  add(Ty, NewMI);
+  add(Ty, false, NewMI);
   return NewMI;
 }
 
 SPIRVType *SPIRVGlobalRegistry::getOrCreateUnknownType(
     const Type *Ty, MachineIRBuilder &MIRBuilder, unsigned Opcode,
     const ArrayRef<MCOperand> Operands) {
-  if (const MachineInstr *MI = findMI(Ty, &MIRBuilder.getMF()))
+  if (const MachineInstr *MI = findMI(Ty, false, &MIRBuilder.getMF()))
     return MI;
   Register ResVReg = createTypeVReg(MIRBuilder);
   const MachineInstr *NewMI =
@@ -1527,7 +1589,7 @@ SPIRVType *SPIRVGlobalRegistry::getOrCreateUnknownType(
         }
         return MIB;
       });
-  add(Ty, NewMI);
+  add(Ty, false, NewMI);
   return NewMI;
 }
 
@@ -1543,7 +1605,7 @@ SPIRVType *SPIRVGlobalRegistry::getOrCreateSPIRVTypeByName(
   if (hasBuiltinTypePrefix(TypeStr))
     return getOrCreateSPIRVType(SPIRV::parseBuiltinTypeNameToTargetExtType(
                                     TypeStr.str(), MIRBuilder.getContext()),
-                                MIRBuilder, AQ, true);
+                                MIRBuilder, AQ, false, true);
 
   // Parse type name in either "typeN" or "type vector[N]" format, where
   // N is the number of elements of the vector.
@@ -1554,7 +1616,7 @@ SPIRVType *SPIRVGlobalRegistry::getOrCreateSPIRVTypeByName(
     // Unable to recognize SPIRV type name
     return nullptr;
 
-  auto SpirvTy = getOrCreateSPIRVType(Ty, MIRBuilder, AQ, true);
+  auto SpirvTy = getOrCreateSPIRVType(Ty, MIRBuilder, AQ, false, true);
 
   // Handle "type*" or  "type* vector[N]".
   if (TypeStr.starts_with("*")) {
@@ -1583,7 +1645,7 @@ SPIRVGlobalRegistry::getOrCreateSPIRVIntegerType(unsigned BitWidth,
                                                  MachineIRBuilder &MIRBuilder) {
   return getOrCreateSPIRVType(
       IntegerType::get(MIRBuilder.getMF().getFunction().getContext(), BitWidth),
-      MIRBuilder, SPIRV::AccessQualifier::ReadWrite, true);
+      MIRBuilder, SPIRV::AccessQualifier::ReadWrite, false, true);
 }
 
 SPIRVType *SPIRVGlobalRegistry::finishCreatingSPIRVType(const Type *LLVMTy,
@@ -1599,7 +1661,7 @@ SPIRVType *SPIRVGlobalRegistry::getOrCreateSPIRVType(unsigned BitWidth,
                                                      const SPIRVInstrInfo &TII,
                                                      unsigned SPIRVOPcode,
                        ...
[truncated]

@s-perron
Copy link
Contributor Author

@VyacheslavLevytskyy I am interested in your thought on the changes to SPIRVIRMapping.Thanks.

@VyacheslavLevytskyy
Copy link
Contributor

@VyacheslavLevytskyy I am interested in your thought on the changes to SPIRVIRMapping.Thanks.

Sure, I'm reviewing right now, by a coincidence :)

Copy link
Contributor

@VyacheslavLevytskyy VyacheslavLevytskyy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should work for the compute part without problems, but I'd like to notify about the change @michalpaszkowski and @MrSidims, so that they are able to check this PR in advance with OpenCL CTS and SYCL CTS in case if they decide that it's worth double checking with extended test suites. The point is that compute environments are quite sensitive to correct types and we used to check big changes in types with CTS to be sure that all works.

@VyacheslavLevytskyy
Copy link
Contributor

aside of the idea to check with one or two compute CTS test suites in advance, this looks good to me

@michalpaszkowski
Copy link
Member

I think this should work for the compute part without problems, but I'd like to notify about the change @michalpaszkowski and @MrSidims, so that they are able to check this PR in advance with OpenCL CTS and SYCL CTS in case if they decide that it's worth double checking with extended test suites. The point is that compute environments are quite sensitive to correct types and we used to check big changes in types with CTS to be sure that all works.

Currently running OpenCL CTS, this takes a while (around 30 hours) -- I should have the results by the end of the day on Wednesday. Will add a review once I get the results.

@VyacheslavLevytskyy / @MrSidims: I don't have the infrastructure setup to run SYCL CTS / DPC++ testing, please check on your end.

@s-perron
Copy link
Contributor Author

s-perron commented May 2, 2025

@michalpaszkowski @MrSidims Any results from the CTS tests?

@michalpaszkowski
Copy link
Member

@michalpaszkowski @MrSidims Any results from the CTS tests?

@s-perron Sorry, this took a bit longer than I anticipated, I found no regressions with OpenCL CTS. The change LGTM from my side.

@asudarsa Would you be able to double-check with DPC++ CI?

Copy link
Contributor

@MrSidims MrSidims left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, I was sick most of the last week, I'll run SYCL E2E testing for the PR today. But ultimately I believe its result shouldn't block this PR from merging.

The code itself is LGTM.

@s-perron s-perron merged commit 492ad84 into llvm:main May 5, 2025
12 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented May 5, 2025

LLVM Buildbot has detected a new failure on builder sanitizer-aarch64-linux-bootstrap-hwasan running on sanitizer-buildbot11 while building llvm at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/55/builds/10878

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 87065 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40..
FAIL: LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll (42896 of 87065)
******************** TEST 'LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o - | /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o -
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o -
1.	Running pass 'Function Pass Manager' on module '/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll'.
2.	Running pass 'SPIRV pre legalizer' on function '@main'
 #0 0x0000b8d79eba113c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:804:13
 #1 0x0000b8d79eb9b8d4 llvm::sys::RunSignalHandlers() /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Support/Signals.cpp:106:18
 #2 0x0000b8d79eba2368 SignalHandler(int, siginfo_t*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
 #3 0x0000f62a6fb748f8 (linux-vdso.so.1+0x8f8)
 #4 0x0000f62a6f4c7608 (/lib/aarch64-linux-gnu/libc.so.6+0x87608)
 #5 0x0000f62a6f47cb3c raise (/lib/aarch64-linux-gnu/libc.so.6+0x3cb3c)
 #6 0x0000f62a6f467e00 abort (/lib/aarch64-linux-gnu/libc.so.6+0x27e00)
 #7 0x0000b8d7972c6b30 __sanitizer::Atexit(void (*)()) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:168:10
 #8 0x0000b8d7972c496c __sanitizer::Die() /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_termination.cpp:52:5
 #9 0x0000b8d7972af7a4 Unlock /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/../sanitizer_common/sanitizer_mutex.h:250:16
#10 0x0000b8d7972af7a4 ~GenericScopedLock /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/../sanitizer_common/sanitizer_mutex.h:386:51
#11 0x0000b8d7972af7a4 __hwasan::ScopedReport::~ScopedReport() /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/hwasan_report.cpp:54:5
#12 0x0000b8d7972aef34 __hwasan::(anonymous namespace)::BaseReport::~BaseReport() /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/hwasan_report.cpp:476:7
#13 0x0000b8d7972accc8 __hwasan::ReportTagMismatch(__sanitizer::StackTrace*, unsigned long, unsigned long, bool, bool, unsigned long*) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/hwasan_report.cpp:1091:1
#14 0x0000b8d7972989c4 Destroy /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/../sanitizer_common/sanitizer_common.h:532:31
#15 0x0000b8d7972989c4 ~InternalMmapVector /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/../sanitizer_common/sanitizer_common.h:642:56
#16 0x0000b8d7972989c4 __hwasan::HandleTagMismatch(__hwasan::AccessInfo, unsigned long, unsigned long, void*, unsigned long*) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/hwasan.cpp:245:1
#17 0x0000b8d79729aef8 __hwasan_tag_mismatch4 /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/hwasan.cpp:764:1
#18 0x0000b8d7972b04a8 __interception::InterceptFunction(char const*, unsigned long*, unsigned long, unsigned long) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/interception/interception_linux.cpp:60:0
#19 0x0000b8d79eaceae0 isScalable /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/include/llvm/Support/TypeSize.h:171:46
#20 0x0000b8d79eaceae0 llvm::TypeSize::operator unsigned long() const /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Support/TypeSize.cpp:51:7
#21 0x0000b8d79a0cd5f4 llvm::SPIRVGlobalRegistry::addStructOffsetDecorations(llvm::Register, llvm::StructType*, llvm::MachineIRBuilder&) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:2069:50
#22 0x0000b8d79a0ccf08 llvm::SPIRVGlobalRegistry::getOpTypeStruct(llvm::StructType const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:0:5
#23 0x0000b8d79a0cf6e4 llvm::SPIRVGlobalRegistry::restOfCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1190:14
#24 0x0000b8d79a0d1f1c getNumEntries /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/include/llvm/ADT/DenseMap.h:848:43
Step 11 (stage2/hwasan check) failure: stage2/hwasan check (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 87065 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40..
FAIL: LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll (42896 of 87065)
******************** TEST 'LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o - | /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o -
+ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o -
1.	Running pass 'Function Pass Manager' on module '/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll'.
2.	Running pass 'SPIRV pre legalizer' on function '@main'
 #0 0x0000b8d79eba113c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:804:13
 #1 0x0000b8d79eb9b8d4 llvm::sys::RunSignalHandlers() /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Support/Signals.cpp:106:18
 #2 0x0000b8d79eba2368 SignalHandler(int, siginfo_t*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
 #3 0x0000f62a6fb748f8 (linux-vdso.so.1+0x8f8)
 #4 0x0000f62a6f4c7608 (/lib/aarch64-linux-gnu/libc.so.6+0x87608)
 #5 0x0000f62a6f47cb3c raise (/lib/aarch64-linux-gnu/libc.so.6+0x3cb3c)
 #6 0x0000f62a6f467e00 abort (/lib/aarch64-linux-gnu/libc.so.6+0x27e00)
 #7 0x0000b8d7972c6b30 __sanitizer::Atexit(void (*)()) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:168:10
 #8 0x0000b8d7972c496c __sanitizer::Die() /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_termination.cpp:52:5
 #9 0x0000b8d7972af7a4 Unlock /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/../sanitizer_common/sanitizer_mutex.h:250:16
#10 0x0000b8d7972af7a4 ~GenericScopedLock /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/../sanitizer_common/sanitizer_mutex.h:386:51
#11 0x0000b8d7972af7a4 __hwasan::ScopedReport::~ScopedReport() /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/hwasan_report.cpp:54:5
#12 0x0000b8d7972aef34 __hwasan::(anonymous namespace)::BaseReport::~BaseReport() /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/hwasan_report.cpp:476:7
#13 0x0000b8d7972accc8 __hwasan::ReportTagMismatch(__sanitizer::StackTrace*, unsigned long, unsigned long, bool, bool, unsigned long*) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/hwasan_report.cpp:1091:1
#14 0x0000b8d7972989c4 Destroy /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/../sanitizer_common/sanitizer_common.h:532:31
#15 0x0000b8d7972989c4 ~InternalMmapVector /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/../sanitizer_common/sanitizer_common.h:642:56
#16 0x0000b8d7972989c4 __hwasan::HandleTagMismatch(__hwasan::AccessInfo, unsigned long, unsigned long, void*, unsigned long*) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/hwasan.cpp:245:1
#17 0x0000b8d79729aef8 __hwasan_tag_mismatch4 /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/hwasan/hwasan.cpp:764:1
#18 0x0000b8d7972b04a8 __interception::InterceptFunction(char const*, unsigned long*, unsigned long, unsigned long) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/compiler-rt/lib/interception/interception_linux.cpp:60:0
#19 0x0000b8d79eaceae0 isScalable /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/include/llvm/Support/TypeSize.h:171:46
#20 0x0000b8d79eaceae0 llvm::TypeSize::operator unsigned long() const /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Support/TypeSize.cpp:51:7
#21 0x0000b8d79a0cd5f4 llvm::SPIRVGlobalRegistry::addStructOffsetDecorations(llvm::Register, llvm::StructType*, llvm::MachineIRBuilder&) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:2069:50
#22 0x0000b8d79a0ccf08 llvm::SPIRVGlobalRegistry::getOpTypeStruct(llvm::StructType const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:0:5
#23 0x0000b8d79a0cf6e4 llvm::SPIRVGlobalRegistry::restOfCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1190:14
#24 0x0000b8d79a0d1f1c getNumEntries /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/include/llvm/ADT/DenseMap.h:848:43

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 6, 2025

LLVM Buildbot has detected a new failure on builder sanitizer-aarch64-linux-bootstrap-asan running on sanitizer-buildbot8 while building llvm at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/24/builds/8092

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 87066 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40..
FAIL: LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll (42513 of 87066)
******************** TEST 'LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o - | /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o -
+ /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll

--

********************
Testing:  0.. 10.. 20.. 30.. 40..
FAIL: LLVM :: CodeGen/SPIRV/spirv-explicit-layout.ll (42744 of 87066)
******************** TEST 'LLVM :: CodeGen/SPIRV/spirv-explicit-layout.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/spirv-explicit-layout.ll -o - | /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/spirv-explicit-layout.ll # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/spirv-explicit-layout.ll
+ /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/spirv-explicit-layout.ll -o -
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/spirv-explicit-layout.ll

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
205.76s: Clang :: Driver/fsanitize.c
159.26s: Clang :: Preprocessor/riscv-target-features.c
136.17s: Clang :: Driver/arm-cortex-cpus-2.c
133.25s: Clang :: Driver/arm-cortex-cpus-1.c
130.40s: Clang :: OpenMP/target_defaultmap_codegen_01.cpp
Step 11 (stage2/asan check) failure: stage2/asan check (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 87066 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40..
FAIL: LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll (42513 of 87066)
******************** TEST 'LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o - | /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o -
+ /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll

--

********************
Testing:  0.. 10.. 20.. 30.. 40..
FAIL: LLVM :: CodeGen/SPIRV/spirv-explicit-layout.ll (42744 of 87066)
******************** TEST 'LLVM :: CodeGen/SPIRV/spirv-explicit-layout.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/spirv-explicit-layout.ll -o - | /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/spirv-explicit-layout.ll # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/spirv-explicit-layout.ll
+ /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/spirv-explicit-layout.ll -o -
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/test/CodeGen/SPIRV/spirv-explicit-layout.ll

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
205.76s: Clang :: Driver/fsanitize.c
159.26s: Clang :: Preprocessor/riscv-target-features.c
136.17s: Clang :: Driver/arm-cortex-cpus-2.c
133.25s: Clang :: Driver/arm-cortex-cpus-1.c
130.40s: Clang :: OpenMP/target_defaultmap_codegen_01.cpp

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 6, 2025

LLVM Buildbot has detected a new failure on builder sanitizer-aarch64-linux-bootstrap-msan running on sanitizer-buildbot9 while building llvm at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/94/builds/6850

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 87064 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40..
FAIL: LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll (42818 of 87064)
******************** TEST 'LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o - | /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o -
+ /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o -
1.	Running pass 'Function Pass Manager' on module '/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll'.
2.	Running pass 'SPIRV pre legalizer' on function '@main'
 #0 0x0000aaaaaf1b5340 ___interceptor_backtrace /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:4513:13
 #1 0x0000aaaab667cfdc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:808:7
 #2 0x0000aaaab6677b40 llvm::sys::RunSignalHandlers() /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Signals.cpp:106:18
 #3 0x0000aaaab667dd74 SignalHandler(int, siginfo_t*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
 #4 0x0000aaaaaf1e746c IsInInterceptorScope /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:77:10
 #5 0x0000aaaaaf1e746c SignalAction(int, void*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:1137:3
 #6 0x0000fffff7ffb8f8 (linux-vdso.so.1+0x8f8)
 #7 0x0000fffff7a87608 (/lib/aarch64-linux-gnu/libc.so.6+0x87608)
 #8 0x0000fffff7a3cb3c raise (/lib/aarch64-linux-gnu/libc.so.6+0x3cb3c)
 #9 0x0000fffff7a27e00 abort (/lib/aarch64-linux-gnu/libc.so.6+0x27e00)
#10 0x0000aaaaaf17507c __sanitizer::Atexit(void (*)()) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:168:10
#11 0x0000aaaaaf172eb8 __sanitizer::Die() /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_termination.cpp:52:5
#12 0x0000aaaaaf188770 __msan_warning_with_origin /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan.cpp:409:0
#13 0x0000aaaab65bb39c llvm::TypeSize::operator unsigned long() const /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/TypeSize.cpp:58:1
#14 0x0000aaaab1ef1f6c llvm::SPIRVGlobalRegistry::addStructOffsetDecorations(llvm::Register, llvm::StructType*, llvm::MachineIRBuilder&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:2069:50
#15 0x0000aaaab1ef18f4 llvm::SPIRVGlobalRegistry::getOpTypeStruct(llvm::StructType const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:0:5
#16 0x0000aaaab1ef3e20 llvm::SPIRVGlobalRegistry::restOfCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1190:14
#17 0x0000aaaab1ef66a0 llvm::SPIRVGlobalRegistry::getOrCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:0:20
#18 0x0000aaaab1ef8ca4 operands_impl /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h:347:13
#19 0x0000aaaab1ef8ca4 defs /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h:723:12
#20 0x0000aaaab1ef8ca4 llvm::SPIRVGlobalRegistry::getOrCreateVulkanBufferType(llvm::MachineIRBuilder&, llvm::Type*, llvm::SPIRV::StorageClass::StorageClass, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1445:30
#21 0x0000aaaab1f3e8d4 getVulkanBufferType /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp:3163:14
#22 0x0000aaaab1f3e8d4 llvm::SPIRV::lowerBuiltinType(llvm::Type const*, llvm::SPIRV::AccessQualifier::AccessQualifier, llvm::MachineIRBuilder&, llvm::SPIRVGlobalRegistry*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp:3242:18
#23 0x0000aaaab1ef3e20 llvm::SPIRVGlobalRegistry::restOfCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1190:14
#24 0x0000aaaab1ef66a0 llvm::SPIRVGlobalRegistry::getOrCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:0:20
Step 11 (stage2/msan check) failure: stage2/msan check (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 87064 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40..
FAIL: LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll (42818 of 87064)
******************** TEST 'LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o - | /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o -
+ /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o -
1.	Running pass 'Function Pass Manager' on module '/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll'.
2.	Running pass 'SPIRV pre legalizer' on function '@main'
 #0 0x0000aaaaaf1b5340 ___interceptor_backtrace /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:4513:13
 #1 0x0000aaaab667cfdc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:808:7
 #2 0x0000aaaab6677b40 llvm::sys::RunSignalHandlers() /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Signals.cpp:106:18
 #3 0x0000aaaab667dd74 SignalHandler(int, siginfo_t*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
 #4 0x0000aaaaaf1e746c IsInInterceptorScope /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:77:10
 #5 0x0000aaaaaf1e746c SignalAction(int, void*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:1137:3
 #6 0x0000fffff7ffb8f8 (linux-vdso.so.1+0x8f8)
 #7 0x0000fffff7a87608 (/lib/aarch64-linux-gnu/libc.so.6+0x87608)
 #8 0x0000fffff7a3cb3c raise (/lib/aarch64-linux-gnu/libc.so.6+0x3cb3c)
 #9 0x0000fffff7a27e00 abort (/lib/aarch64-linux-gnu/libc.so.6+0x27e00)
#10 0x0000aaaaaf17507c __sanitizer::Atexit(void (*)()) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:168:10
#11 0x0000aaaaaf172eb8 __sanitizer::Die() /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_termination.cpp:52:5
#12 0x0000aaaaaf188770 __msan_warning_with_origin /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan.cpp:409:0
#13 0x0000aaaab65bb39c llvm::TypeSize::operator unsigned long() const /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/TypeSize.cpp:58:1
#14 0x0000aaaab1ef1f6c llvm::SPIRVGlobalRegistry::addStructOffsetDecorations(llvm::Register, llvm::StructType*, llvm::MachineIRBuilder&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:2069:50
#15 0x0000aaaab1ef18f4 llvm::SPIRVGlobalRegistry::getOpTypeStruct(llvm::StructType const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:0:5
#16 0x0000aaaab1ef3e20 llvm::SPIRVGlobalRegistry::restOfCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1190:14
#17 0x0000aaaab1ef66a0 llvm::SPIRVGlobalRegistry::getOrCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:0:20
#18 0x0000aaaab1ef8ca4 operands_impl /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h:347:13
#19 0x0000aaaab1ef8ca4 defs /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h:723:12
#20 0x0000aaaab1ef8ca4 llvm::SPIRVGlobalRegistry::getOrCreateVulkanBufferType(llvm::MachineIRBuilder&, llvm::Type*, llvm::SPIRV::StorageClass::StorageClass, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1445:30
#21 0x0000aaaab1f3e8d4 getVulkanBufferType /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp:3163:14
#22 0x0000aaaab1f3e8d4 llvm::SPIRV::lowerBuiltinType(llvm::Type const*, llvm::SPIRV::AccessQualifier::AccessQualifier, llvm::MachineIRBuilder&, llvm::SPIRVGlobalRegistry*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp:3242:18
#23 0x0000aaaab1ef3e20 llvm::SPIRVGlobalRegistry::restOfCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1190:14
#24 0x0000aaaab1ef66a0 llvm::SPIRVGlobalRegistry::getOrCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:0:20
Step 16 (stage2/msan_track_origins check) failure: stage2/msan_track_origins check (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/ld.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/lld-link
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/ld64.lld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/wasm-ld
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 87064 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40..
FAIL: LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll (42737 of 87064)
******************** TEST 'LLVM :: CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o - | /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll # RUN: at line 1
+ /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o -
+ /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/FileCheck /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm_build_msan_track_origins/bin/llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll -o -
1.	Running pass 'Function Pass Manager' on module '/home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/test/CodeGen/SPIRV/hlsl-resources/StructuredBuffer.ll'.
2.	Running pass 'SPIRV pre legalizer' on function '@main'
 #0 0x0000aaaaaf58b140 ___interceptor_backtrace /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:4513:13
 #1 0x0000aaaab99110d4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:13
 #2 0x0000aaaab9909aac llvm::sys::RunSignalHandlers() /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Signals.cpp:106:18
 #3 0x0000aaaab9912370 SignalHandler(int, siginfo_t*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
 #4 0x0000aaaaaf5bd26c IsInInterceptorScope /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:77:10
 #5 0x0000aaaaaf5bd26c SignalAction(int, void*, void*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:1137:3
 #6 0x0000fffff7ffb8f8 (linux-vdso.so.1+0x8f8)
 #7 0x0000fffff79e7608 (/lib/aarch64-linux-gnu/libc.so.6+0x87608)
 #8 0x0000fffff799cb3c raise (/lib/aarch64-linux-gnu/libc.so.6+0x3cb3c)
 #9 0x0000fffff7987e00 abort (/lib/aarch64-linux-gnu/libc.so.6+0x27e00)
#10 0x0000aaaaaf54ae7c __sanitizer::Atexit(void (*)()) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:168:10
#11 0x0000aaaaaf548cb8 __sanitizer::Die() /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_termination.cpp:52:5
#12 0x0000aaaaaf55e608 __msan_init /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan.cpp:444:0
#13 0x0000aaaab9801670 llvm::TypeSize::operator unsigned long() const /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/TypeSize.cpp:0:7
#14 0x0000aaaab34eb934 llvm::SPIRVGlobalRegistry::addStructOffsetDecorations(llvm::Register, llvm::StructType*, llvm::MachineIRBuilder&) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:0:50
#15 0x0000aaaab34eafa0 llvm::SPIRVGlobalRegistry::getOpTypeStruct(llvm::StructType const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:0:5
#16 0x0000aaaab34ee314 llvm::SPIRVGlobalRegistry::restOfCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1190:14
#17 0x0000aaaab34f1878 llvm::SPIRVGlobalRegistry::getOrCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1261:19
#18 0x0000aaaab34f475c operands_impl /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h:347:13
#19 0x0000aaaab34f475c defs /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h:723:12
#20 0x0000aaaab34f475c llvm::SPIRVGlobalRegistry::getOrCreateVulkanBufferType(llvm::MachineIRBuilder&, llvm::Type*, llvm::SPIRV::StorageClass::StorageClass, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1445:30
#21 0x0000aaaab3555524 llvm::SPIRV::lowerBuiltinType(llvm::Type const*, llvm::SPIRV::AccessQualifier::AccessQualifier, llvm::MachineIRBuilder&, llvm::SPIRVGlobalRegistry*) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp:0:0
#22 0x0000aaaab34ee314 llvm::SPIRVGlobalRegistry::restOfCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1190:14
#23 0x0000aaaab34f1878 llvm::SPIRVGlobalRegistry::getOrCreateSPIRVType(llvm::Type const*, llvm::MachineIRBuilder&, llvm::SPIRV::AccessQualifier::AccessQualifier, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:1261:19
#24 0x0000aaaab358d038 getOrCreateSPIRVType /home/b/sanitizer-aarch64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h:312:12

s-perron added a commit to s-perron/llvm-project that referenced this pull request May 6, 2025
When the DataLayout is destroyed, the memory backing `Offsets` is
released. This causes a use after free.

To fix it, I added a DataLayout varible that will not be destroyed until
after Offsets is used.

Fixes asan failure caused by llvm#135789
@s-perron
Copy link
Contributor Author

s-perron commented May 6, 2025

I opened #138695 to fix the asan failures.

s-perron added a commit that referenced this pull request May 6, 2025
When the DataLayout is destroyed, the memory backing `Offsets` is
released. This causes a use after free.

To fix it, I added a DataLayout varible that will not be destroyed until
after Offsets is used.

Fixes asan failure caused by
#135789
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request May 7, 2025
When the DataLayout is destroyed, the memory backing `Offsets` is
released. This causes a use after free.

To fix it, I added a DataLayout varible that will not be destroyed until
after Offsets is used.

Fixes asan failure caused by
llvm/llvm-project#135789
s-perron added a commit to s-perron/llvm-project that referenced this pull request May 7, 2025
The asan failure was fixed by llvm#138695, but another failure was
introduced in the meantime. The cause for the other failure has been
fixed. I will reapply the two PRs.

Reapply "[SPIRV] Add explicit layout (llvm#135789)"

This reverts commit 0fb5720.

Reapply "[SPIRV] Fix asan failure (llvm#138695)"

This reverts commit df90ab9.
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
Adds code to add offset decorations when needed. This could cause a
type mismatch for memory instructions. We add code to fix up OpLoad
instructions, so that we could get some tests. Other memory operations
will be handled in another PR.

Part of llvm#134119.
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
When the DataLayout is destroyed, the memory backing `Offsets` is
released. This causes a use after free.

To fix it, I added a DataLayout varible that will not be destroyed until
after Offsets is used.

Fixes asan failure caused by
llvm#135789
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
s-perron added a commit that referenced this pull request May 7, 2025
The asan failure was fixed by #138695, but another failure was
introduced in the meantime. The cause for the other failure has been
fixed. I will reapply the two PRs.

Reapply "[SPIRV] Add explicit layout (#135789)"

This reverts commit 0fb5720.

Reapply "[SPIRV] Fix asan failure (#138695)"

This reverts commit df90ab9.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants