Skip to content

Commit 05061fb

Browse files
remove comments
1 parent 7a23989 commit 05061fb

File tree

2 files changed

+5
-58
lines changed

2 files changed

+5
-58
lines changed

llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -509,27 +509,6 @@ void SPIRVEmitIntrinsics::propagateElemTypeRec(
509509
continue;
510510
if (!VisitedSubst.insert(std::make_pair(U, Op)).second)
511511
continue;
512-
/*
513-
if (auto *Ref = dyn_cast<GetElementPtrInst>(U)) {
514-
CallInst *AssignCI = GR->findAssignPtrTypeInstr(Ref);
515-
if (AssignCI && Ref->getPointerOperand() == Op) {
516-
Type *PrevElemTy = GR->findDeducedElementType(Ref);
517-
assert(PrevElemTy && "Expected valid element type");
518-
// evaluate a new GEP type
519-
Type *NewElemTy = PtrElemTy;
520-
for (Use &RefUse : drop_begin(Ref->indices()))
521-
NewElemTy =
522-
GetElementPtrInst::getTypeAtIndex(NewElemTy, RefUse.get());
523-
// record the new GEP type
524-
assert(NewElemTy && "Expected valid GEP indices");
525-
updateAssignType(AssignCI, Ref, PoisonValue::get(NewElemTy));
526-
// recursively propagate change
527-
propagateElemTypeRec(Ref, NewElemTy, PrevElemTy, VisitedSubst, Visited,
528-
Ptrcasts);
529-
}
530-
continue;
531-
}
532-
*/
533512
Instruction *UI = dyn_cast<Instruction>(U);
534513
// If the instruction was validated already, we need to keep it valid by
535514
// keeping current Op type.
@@ -652,25 +631,6 @@ Type *SPIRVEmitIntrinsics::deduceElementTypeHelper(
652631
} else {
653632
Ty = Ref->getResultElementType();
654633
}
655-
/*
656-
if (Type *PtrElemTy = GR->findDeducedElementType(Ref->getPointerOperand()))
657-
{ Ty = PtrElemTy; for (Use &U : drop_begin(Ref->indices())) Ty =
658-
GetElementPtrInst::getTypeAtIndex(Ty, U.get()); if
659-
(isTodoType(Ref->getPointerOperand())) insertTodoType(Ref); } else if
660-
(isNestedPointer(Ref->getSourceElementType())) { Ty =
661-
Ref->getSourceElementType(); for (Use &U : drop_begin(Ref->indices())) Ty =
662-
GetElementPtrInst::getTypeAtIndex(Ty, U.get()); } else { Ty =
663-
Ref->getResultElementType();
664-
}
665-
*/
666-
/*
667-
if (isNestedPointer(Ref->getSourceElementType())) {
668-
Type *PtrElemTy = GR->findDeducedElementType(Ref->getPointerOperand());
669-
Ty = PtrElemTy ? PtrElemTy : Ref->getSourceElementType();
670-
for (Use &U : drop_begin(Ref->indices()))
671-
Ty = GetElementPtrInst::getTypeAtIndex(Ty, U.get());
672-
}
673-
*/
674634
} else if (auto *Ref = dyn_cast<LoadInst>(I)) {
675635
Value *Op = Ref->getPointerOperand();
676636
Type *KnownTy = GR->findDeducedElementType(Op);
@@ -1493,22 +1453,18 @@ void SPIRVEmitIntrinsics::insertPtrCastOrAssignTypeInstr(Instruction *I,
14931453
if (SI) {
14941454
Value *Op = SI->getValueOperand();
14951455
Value *Pointer = SI->getPointerOperand();
1496-
// if (!GR->findDeducedElementType(Pointer) || isTodoType(Pointer)) {
14971456
Type *OpTy = Op->getType();
14981457
if (auto *OpI = dyn_cast<Instruction>(Op))
14991458
OpTy = restoreMutatedType(GR, OpI, OpTy);
15001459
if (OpTy == Op->getType())
15011460
OpTy = deduceElementTypeByValueDeep(OpTy, Op, false);
15021461
replacePointerOperandWithPtrCast(I, Pointer, OpTy, 1, B);
1503-
//}
15041462
return;
15051463
}
15061464
if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
15071465
Value *Pointer = LI->getPointerOperand();
1508-
// if (!GR->findDeducedElementType(Pointer) || isTodoType(Pointer)) {
15091466
Type *OpTy = LI->getType();
15101467
if (auto *PtrTy = dyn_cast<PointerType>(OpTy)) {
1511-
// TODO: isNestedPointer() instead of dyn_cast<PointerType>
15121468
if (Type *ElemTy = GR->findDeducedElementType(LI)) {
15131469
OpTy = getTypedPointerWrapper(ElemTy, PtrTy->getAddressSpace());
15141470
} else {
@@ -1519,7 +1475,6 @@ void SPIRVEmitIntrinsics::insertPtrCastOrAssignTypeInstr(Instruction *I,
15191475
}
15201476
}
15211477
replacePointerOperandWithPtrCast(I, Pointer, OpTy, 0, B);
1522-
//}
15231478
return;
15241479
}
15251480
if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(I)) {
@@ -2250,14 +2205,6 @@ bool SPIRVEmitIntrinsics::postprocessTypes(Module &M) {
22502205
if (ElemTy != KnownTy) {
22512206
DenseSet<std::pair<Value *, Value *>> VisitedSubst;
22522207
propagateElemType(CI, ElemTy, VisitedSubst);
2253-
/*
2254-
if (isa<CallInst>(Op)) {
2255-
propagateElemType(CI, ElemTy, VisitedSubst);
2256-
} else {
2257-
updateAssignType(AssignCI, CI, PoisonValue::get(ElemTy));
2258-
propagateElemTypeRec(CI, ElemTy, KnownTy, VisitedSubst);
2259-
}
2260-
*/
22612208
eraseTodoType(Op);
22622209
continue;
22632210
}

llvm/lib/Target/SPIRV/SPIRVISelLowering.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,11 @@ void SPIRVTargetLowering::finalizeLowering(MachineFunction &MF) const {
394394
case SPIRV::OpGenericCastToPtr:
395395
validateAccessChain(STI, MRI, GR, MI);
396396
break;
397-
// case SPIRV::OpPtrAccessChain:
398-
// case SPIRV::OpInBoundsPtrAccessChain:
399-
// if (MI.getNumOperands() == 4)
400-
// validateAccessChain(STI, MRI, GR, MI);
401-
// break;
397+
case SPIRV::OpPtrAccessChain:
398+
case SPIRV::OpInBoundsPtrAccessChain:
399+
if (MI.getNumOperands() == 4)
400+
validateAccessChain(STI, MRI, GR, MI);
401+
break;
402402

403403
case SPIRV::OpFunctionCall:
404404
// ensure there is no mismatch between actual and expected arg types:

0 commit comments

Comments
 (0)