Skip to content

Commit c8e8867

Browse files
authored
Update more llvm::PointerUnion::get calls (#2962)
Update for llvm-project commit abba01adad5d ("[ADT] Deprecate PointerUnion::{is,get} (NFC) (#122623)", 2025-01-13).
1 parent d9e871a commit c8e8867

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/SPIRV/LLVMToSPIRVDbgTran.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ LLVMToSPIRVDbgTran::transDbgArrayTypeOpenCL(const DICompositeType *AT) {
689689
SPIRVWordVec LowerBounds(N);
690690
for (unsigned I = 0; I < N; ++I) {
691691
DISubrange *SR = cast<DISubrange>(AR[I]);
692-
ConstantInt *Count = SR->getCount().get<ConstantInt *>();
692+
ConstantInt *Count = cast<ConstantInt *>(SR->getCount());
693693
if (AT->isVector()) {
694694
assert(N == 1 && "Multidimensional vector is not expected!");
695695
Ops[ComponentCountIdx] = static_cast<SPIRVWord>(Count->getZExtValue());
@@ -710,7 +710,7 @@ LLVMToSPIRVDbgTran::transDbgArrayTypeOpenCL(const DICompositeType *AT) {
710710
if (auto *DIExprLB = dyn_cast<MDNode>(RawLB))
711711
LowerBounds[I] = transDbgEntry(DIExprLB)->getId();
712712
else {
713-
ConstantInt *ConstIntLB = SR->getLowerBound().get<ConstantInt *>();
713+
ConstantInt *ConstIntLB = cast<ConstantInt *>(SR->getLowerBound());
714714
LowerBounds[I] = SPIRVWriter->transValue(ConstIntLB, nullptr)->getId();
715715
}
716716
} else {
@@ -733,7 +733,7 @@ LLVMToSPIRVDbgTran::transDbgArrayTypeNonSemantic(const DICompositeType *AT) {
733733
Ops.resize(SubrangesIdx + N);
734734
for (unsigned I = 0; I < N; ++I) {
735735
DISubrange *SR = cast<DISubrange>(AR[I]);
736-
ConstantInt *Count = SR->getCount().get<ConstantInt *>();
736+
ConstantInt *Count = cast<ConstantInt *>(SR->getCount());
737737
if (AT->isVector()) {
738738
assert(N == 1 && "Multidimensional vector is not expected!");
739739
Ops[ComponentCountIdx] = static_cast<SPIRVWord>(Count->getZExtValue());
@@ -809,13 +809,13 @@ SPIRVEntry *LLVMToSPIRVDbgTran::transDbgSubrangeType(const DISubrange *ST) {
809809
ConstantInt *IntNode = nullptr;
810810
switch (Idx) {
811811
case LowerBoundIdx:
812-
IntNode = ST->getLowerBound().get<ConstantInt *>();
812+
IntNode = cast<ConstantInt *>(ST->getLowerBound());
813813
break;
814814
case UpperBoundIdx:
815-
IntNode = ST->getUpperBound().get<ConstantInt *>();
815+
IntNode = cast<ConstantInt *>(ST->getUpperBound());
816816
break;
817817
case CountIdx:
818-
IntNode = ST->getCount().get<ConstantInt *>();
818+
IntNode = cast<ConstantInt *>(ST->getCount());
819819
break;
820820
}
821821
Ops[Idx] = IntNode ? SPIRVWriter->transValue(IntNode, nullptr)->getId()
@@ -830,7 +830,7 @@ SPIRVEntry *LLVMToSPIRVDbgTran::transDbgSubrangeType(const DISubrange *ST) {
830830
Ops[StrideIdx] = transDbgEntry(Node)->getId();
831831
else
832832
Ops[StrideIdx] =
833-
SPIRVWriter->transValue(ST->getStride().get<ConstantInt *>(), nullptr)
833+
SPIRVWriter->transValue(cast<ConstantInt *>(ST->getStride()), nullptr)
834834
->getId();
835835
}
836836
return BM->addDebugInfo(SPIRVDebug::TypeSubrange, getVoidTy(), Ops);

lib/SPIRV/SPIRVReader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,11 +2644,11 @@ Value *SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
26442644
case SPIRVEIS_NonSemantic_Shader_DebugInfo_200:
26452645
if (!M->IsNewDbgInfoFormat) {
26462646
return mapValue(
2647-
BV, DbgTran->transDebugIntrinsic(ExtInst, BB).get<Instruction *>());
2647+
BV, cast<Instruction *>(DbgTran->transDebugIntrinsic(ExtInst, BB)));
26482648
} else {
26492649
auto MaybeRecord = DbgTran->transDebugIntrinsic(ExtInst, BB);
26502650
if (!MaybeRecord.isNull()) {
2651-
auto *Record = MaybeRecord.get<DbgRecord *>();
2651+
auto *Record = cast<DbgRecord *>(MaybeRecord);
26522652
Record->setDebugLoc(
26532653
DbgTran->transDebugScope(static_cast<SPIRVInstruction *>(BV)));
26542654
}

0 commit comments

Comments
 (0)