Skip to content

Commit 9b04d62

Browse files
jgu222gfxbot
authored andcommitted
Internal change
Change-Id: I19039c6a062fcf34a8354be6119b17ee353b0141
1 parent 59abed4 commit 9b04d62

File tree

1 file changed

+31
-14
lines changed

1 file changed

+31
-14
lines changed

IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,23 +1310,40 @@ void COpenCLKernel::ParseShaderSpecificOpcode( llvm::Instruction* inst )
13101310

13111311
if (CallInst* CallI = dyn_cast<CallInst>(inst))
13121312
{
1313-
1314-
// Checking stateless access info
1315-
if (!isa<IntrinsicInst>(CallI) && !isa<GenIntrinsicInst>(CallI)) {
1316-
// function/subroutine call. Give up
1317-
SetHasConstantStatelessAccess();
1318-
SetHasGlobalStatelessAccess();
1313+
bool mayHasMemoryAccess = true; // for checking stateless access
1314+
if (GenIntrinsicInst* GII = dyn_cast<GenIntrinsicInst>(CallI))
1315+
{
1316+
GenISAIntrinsic::ID id = GII->getIntrinsicID();
1317+
switch (id)
1318+
{
1319+
default:
1320+
break;
1321+
case GenISAIntrinsic::GenISA_ptr_to_pair:
1322+
case GenISAIntrinsic::GenISA_pair_to_ptr:
1323+
mayHasMemoryAccess = false;
1324+
break;
1325+
} // End of switch
13191326
}
1320-
else
1327+
1328+
if (mayHasMemoryAccess)
13211329
{
1322-
for (int i = 0, e = (int)CallI->getNumArgOperands(); i < e; ++i)
1330+
// Checking stateless access info
1331+
if (!isa<IntrinsicInst>(CallI) && !isa<GenIntrinsicInst>(CallI)) {
1332+
// function/subroutine call. Give up
1333+
SetHasConstantStatelessAccess();
1334+
SetHasGlobalStatelessAccess();
1335+
}
1336+
else
13231337
{
1324-
Value* arg = CallI->getArgOperand(i);
1325-
PointerType* PTy = dyn_cast<PointerType>(arg->getType());
1326-
if (!PTy)
1327-
continue;
1328-
unsigned AS = PTy->getAddressSpace();
1329-
setStatelessAccess(AS);
1338+
for (int i = 0, e = (int)CallI->getNumArgOperands(); i < e; ++i)
1339+
{
1340+
Value* arg = CallI->getArgOperand(i);
1341+
PointerType* PTy = dyn_cast<PointerType>(arg->getType());
1342+
if (!PTy)
1343+
continue;
1344+
unsigned AS = PTy->getAddressSpace();
1345+
setStatelessAccess(AS);
1346+
}
13301347
}
13311348
}
13321349
}

0 commit comments

Comments
 (0)