@@ -499,7 +499,8 @@ CallInst *OCLToSPIRVBase::visitCallAtomicCmpXchg(CallInst *CI) {
499499}
500500
501501void OCLToSPIRVBase::visitCallAtomicInit (CallInst *CI) {
502- auto *ST = new StoreInst (CI->getArgOperand (1 ), CI->getArgOperand (0 ), CI);
502+ auto *ST = new StoreInst (CI->getArgOperand (1 ), CI->getArgOperand (0 ),
503+ CI->getIterator ());
503504 ST->takeName (CI);
504505 CI->dropAllReferences ();
505506 CI->eraseFromParent ();
@@ -515,11 +516,11 @@ void OCLToSPIRVBase::visitCallAllAny(spv::Op OC, CallInst *CI) {
515516 auto *Zero = Constant::getNullValue (Args[0 ]->getType ());
516517
517518 auto *Cmp = CmpInst::Create (CmpInst::ICmp, CmpInst::ICMP_SLT, Args[0 ], Zero,
518- " cast" , CI);
519+ " cast" , CI-> getIterator () );
519520
520521 if (!isa<VectorType>(ArgTy)) {
521- auto *Cast = CastInst::CreateZExtOrBitCast (Cmp, Type::getInt32Ty (*Ctx), " " ,
522- Cmp->getNextNode ());
522+ auto *Cast = CastInst::CreateZExtOrBitCast (
523+ Cmp, Type::getInt32Ty (*Ctx), " " , Cmp->getNextNode ()-> getIterator ());
523524 CI->replaceAllUsesWith (Cast);
524525 CI->eraseFromParent ();
525526 } else {
@@ -1040,13 +1041,15 @@ void OCLToSPIRVBase::visitCallGetImageSize(CallInst *CI,
10401041 Constant *Index[] = {getInt32 (M, 0 ), getInt32 (M, 1 ), getInt32 (M, 2 ),
10411042 getInt32 (M, 3 )};
10421043 return new ShuffleVectorInst (NCI, ZeroVec,
1043- ConstantVector::get (Index), " " , CI);
1044+ ConstantVector::get (Index), " " ,
1045+ CI->getIterator ());
10441046
10451047 } else if (Desc.Dim == Dim2D && Desc.Arrayed ) {
10461048 Constant *Index[] = {getInt32 (M, 0 ), getInt32 (M, 1 )};
10471049 Constant *Mask = ConstantVector::get (Index);
10481050 return new ShuffleVectorInst (NCI, UndefValue::get (NCI->getType ()),
1049- Mask, NCI->getName (), CI);
1051+ Mask, NCI->getName (),
1052+ CI->getIterator ());
10501053 }
10511054 return NCI;
10521055 }
@@ -1056,7 +1059,7 @@ void OCLToSPIRVBase::visitCallGetImageSize(CallInst *CI,
10561059 .Case (kOCLBuiltinName ::GetImageDepth, 2 )
10571060 .Case (kOCLBuiltinName ::GetImageArraySize, Dim - 1 );
10581061 return ExtractElementInst::Create (NCI, getUInt32 (M, I), " " ,
1059- NCI->getNextNode ());
1062+ NCI->getNextNode ()-> getIterator () );
10601063 });
10611064}
10621065
@@ -1371,11 +1374,12 @@ void OCLToSPIRVBase::visitCallScalToVec(CallInst *CI, StringRef MangledName,
13711374 getExtOp (MangledName, DemangledName)));
13721375 for (auto I : ScalarPos)
13731376 Mutator.mapArg (I, [&](Value *V) {
1374- Instruction *Inst = InsertElementInst::Create (UndefValue::get (VecTy), V,
1375- getInt32 (M, 0 ), " " , CI);
1377+ Instruction *Inst = InsertElementInst::Create (
1378+ UndefValue::get (VecTy), V, getInt32 (M, 0 ), " " , CI-> getIterator () );
13761379 return new ShuffleVectorInst (
13771380 Inst, UndefValue::get (VecTy),
1378- ConstantVector::getSplat (VecElemCount, getInt32 (M, 0 )), " " , CI);
1381+ ConstantVector::getSplat (VecElemCount, getInt32 (M, 0 )), " " ,
1382+ CI->getIterator ());
13791383 });
13801384}
13811385
@@ -1488,7 +1492,7 @@ void OCLToSPIRVBase::visitCallEnqueueKernel(CallInst *CI,
14881492 LocalSizeArray->getSourceElementType (), // Pointee type
14891493 LocalSizeArray->getPointerOperand (), // Alloca
14901494 {getInt32 (M, 0 ), getInt32 (M, I)}, // Indices
1491- " " , CI));
1495+ " " , CI-> getIterator () ));
14921496 }
14931497
14941498 StringRef NewName = " __spirv_EnqueueKernel__" ;
@@ -1497,7 +1501,7 @@ void OCLToSPIRVBase::visitCallEnqueueKernel(CallInst *CI,
14971501 Function *NewF =
14981502 Function::Create (FT, GlobalValue::ExternalLinkage, NewName, M);
14991503 NewF->setCallingConv (CallingConv::SPIR_FUNC);
1500- CallInst *NewCall = CallInst::Create (NewF, Args, " " , CI);
1504+ CallInst *NewCall = CallInst::Create (NewF, Args, " " , CI-> getIterator () );
15011505 NewCall->setCallingConv (NewF->getCallingConv ());
15021506 CI->replaceAllUsesWith (NewCall);
15031507 CI->eraseFromParent ();
0 commit comments