Skip to content

Commit 7d0f3c3

Browse files
authored
Change VectorType to FixedVectorType to help move to newer llvm. (#4085)
1 parent 736c2aa commit 7d0f3c3

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

include/llvm/IR/DerivedTypes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,8 @@ class VectorType : public SequentialType {
442442
return T->getTypeID() == VectorTyID;
443443
}
444444
};
445-
445+
// HLSL change - add FixedVectorType to help move to newer llvm.
446+
using FixedVectorType = VectorType;
446447

447448
/// PointerType - Class to represent pointers.
448449
///

lib/DXIL/DxilUtil.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ GetLegacyCBufferFieldElementSize(DxilFieldAnnotation &fieldAnnotation,
7676
unsigned compSize = compType.Is64Bit() ? 8 : compType.Is16Bit() && !typeSys.UseMinPrecision() ? 2 : 4;
7777
unsigned fieldSize = compSize;
7878
if (Ty->isVectorTy()) {
79-
fieldSize *= Ty->getVectorNumElements();
79+
fieldSize *= cast<FixedVectorType>(Ty)->getNumElements();
8080
} else if (StructType *ST = dyn_cast<StructType>(Ty)) {
8181
DxilStructAnnotation *EltAnnotation = typeSys.GetStructAnnotation(ST);
8282
if (EltAnnotation) {
@@ -357,8 +357,8 @@ bool IsResourceSingleComponent(Type *Ty) {
357357
return false;
358358
}
359359
return IsResourceSingleComponent(structType->getStructElementType(0));
360-
} else if (llvm::VectorType *vectorType =
361-
llvm::dyn_cast<llvm::VectorType>(Ty)) {
360+
} else if (llvm::FixedVectorType *vectorType =
361+
llvm::dyn_cast<llvm::FixedVectorType>(Ty)) {
362362
if (vectorType->getNumElements() > 1) {
363363
return false;
364364
}
@@ -379,8 +379,8 @@ uint8_t GetResourceComponentCount(llvm::Type *Ty) {
379379
}
380380
DXASSERT(Count <= 4, "Component Count out of bound.");
381381
return Count;
382-
} else if (llvm::VectorType *vectorType =
383-
llvm::dyn_cast<llvm::VectorType>(Ty)) {
382+
} else if (llvm::FixedVectorType *vectorType =
383+
llvm::dyn_cast<llvm::FixedVectorType>(Ty)) {
384384
return vectorType->getNumElements();
385385
}
386386
return 1;

0 commit comments

Comments
 (0)