Skip to content

Commit 4c5b76e

Browse files
committed
SPIRV: Try to fix validation errors
1 parent 751d1a2 commit 4c5b76e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ void SPIRVEmitIntrinsics::deduceOperandElementType(
11081108
IRBuilder<> B(Ctx);
11091109
for (auto &OpIt : Ops) {
11101110
Value *Op = OpIt.first;
1111-
if (!Op->hasUseList() || Op->use_empty())
1111+
if (Op->use_empty())
11121112
continue;
11131113
if (AskOps && !AskOps->contains(Op))
11141114
continue;
@@ -1124,7 +1124,8 @@ void SPIRVEmitIntrinsics::deduceOperandElementType(
11241124
continue;
11251125
Value *OpTyVal = getNormalizedPoisonValue(KnownElemTy);
11261126
Type *OpTy = Op->getType();
1127-
if (!Ty || AskTy || isUntypedPointerTy(Ty) || isTodoType(Op)) {
1127+
if (Op->hasUseList() &&
1128+
(!Ty || AskTy || isUntypedPointerTy(Ty) || isTodoType(Op))) {
11281129
Type *PrevElemTy = GR->findDeducedElementType(Op);
11291130
GR->addDeducedElementType(Op, normalizeType(KnownElemTy));
11301131
// check if KnownElemTy is complete
@@ -1637,9 +1638,6 @@ void SPIRVEmitIntrinsics::insertPtrCastOrAssignTypeInstr(Instruction *I,
16371638
if (!isPointerTy(ArgOperand->getType()))
16381639
continue;
16391640

1640-
if (!ArgOperand->hasUseList())
1641-
continue;
1642-
16431641
// Constants (nulls/undefs) are handled in insertAssignPtrTypeIntrs()
16441642
if (!isa<Instruction>(ArgOperand) && !isa<Argument>(ArgOperand)) {
16451643
// However, we may have assumptions about the formal argument's type and

0 commit comments

Comments
 (0)