@@ -412,8 +412,10 @@ void StatelessToStatefull::visitCallInst(CallInst& I)
412
412
{
413
413
if (auto Inst = dyn_cast<GenIntrinsicInst>(&I))
414
414
{
415
- if (Inst->getIntrinsicID () == GenISAIntrinsic::GenISA_simdBlockRead ||
416
- Inst->getIntrinsicID () == GenISAIntrinsic::GenISA_simdBlockWrite)
415
+ GenISAIntrinsic::ID const intrinID = Inst->getIntrinsicID ();
416
+
417
+ if (intrinID == GenISAIntrinsic::GenISA_simdBlockRead ||
418
+ intrinID == GenISAIntrinsic::GenISA_simdBlockWrite)
417
419
{
418
420
Module* M = Inst->getParent ()->getParent ()->getParent ();
419
421
Function* F = Inst->getParent ()->getParent ();
@@ -428,7 +430,7 @@ void StatelessToStatefull::visitCallInst(CallInst& I)
428
430
}
429
431
430
432
Value* offset = nullptr ;
431
- unsigned int baseArgNumber = 0 ;
433
+ unsigned int baseArgNumber = 0 ;
432
434
if (pointerIsPositiveOffsetFromKernelArgument (F, ptr, offset, baseArgNumber))
433
435
{
434
436
ModuleMetaData* modMD = getAnalysis<MetaDataUtilsWrapper>().getModuleMetaData ();
@@ -441,13 +443,13 @@ void StatelessToStatefull::visitCallInst(CallInst& I)
441
443
unsigned addrSpace = EncodeAS4GFXResource (*resourceNumber, BufferType::UAV, 0 );
442
444
setPointerSizeTo32bit (addrSpace, I.getParent ()->getParent ()->getParent ());
443
445
444
- if (Inst-> getIntrinsicID () == GenISAIntrinsic::GenISA_simdBlockRead)
446
+ if (intrinID == GenISAIntrinsic::GenISA_simdBlockRead)
445
447
{
446
448
PointerType* pTy = PointerType::get (Inst->getType (), addrSpace);
447
449
Instruction* pPtrToInt = IntToPtrInst::Create (Instruction::IntToPtr, offset, pTy, " " , Inst);
448
450
Function* simdMediaBlockReadFunc = GenISAIntrinsic::getDeclaration (
449
451
M,
450
- GenISAIntrinsic::GenISA_simdBlockRead ,
452
+ intrinID ,
451
453
{ Inst->getType (),pTy });
452
454
Instruction* simdMediaBlockRead = CallInst::Create (simdMediaBlockReadFunc, { pPtrToInt }, " " , Inst);
453
455
simdMediaBlockRead->setDebugLoc (DL);
@@ -461,13 +463,13 @@ void StatelessToStatefull::visitCallInst(CallInst& I)
461
463
SmallVector<Value*, 2 > args;
462
464
args.push_back (pPtrToInt);
463
465
args.push_back (Inst->getOperand (1 ));
464
- Function* simdMediaBlockWriteFunc = GenISAIntrinsic::getDeclaration (
466
+ Function* pFunc = GenISAIntrinsic::getDeclaration (
465
467
M,
466
- GenISAIntrinsic::GenISA_simdBlockWrite ,
468
+ intrinID ,
467
469
{ pTy,Inst->getOperand (1 )->getType () });
468
- Instruction* simdMediaBlockWrite = CallInst::Create (simdMediaBlockWriteFunc , args, " " , Inst);
469
- simdMediaBlockWrite ->setDebugLoc (DL);
470
- Inst->replaceAllUsesWith (simdMediaBlockWrite );
470
+ Instruction* pIntrinInst = CallInst::Create (pFunc , args, " " , Inst);
471
+ pIntrinInst ->setDebugLoc (DL);
472
+ Inst->replaceAllUsesWith (pIntrinInst );
471
473
Inst->eraseFromParent ();
472
474
}
473
475
0 commit comments