@@ -1310,23 +1310,40 @@ void COpenCLKernel::ParseShaderSpecificOpcode( llvm::Instruction* inst )
1310
1310
1311
1311
if (CallInst* CallI = dyn_cast<CallInst>(inst))
1312
1312
{
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
1319
1326
}
1320
- else
1327
+
1328
+ if (mayHasMemoryAccess)
1321
1329
{
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
1323
1337
{
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
+ }
1330
1347
}
1331
1348
}
1332
1349
}
0 commit comments