File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
IGC/AdaptorCommon/RayTracing Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -401,6 +401,16 @@ bool DynamicRayManagementPass::TryProceedBasedApproach(Function& F)
401
401
for (auto * checkBB : checkBBs)
402
402
{
403
403
auto * IP = checkBB->getFirstNonPHI ();
404
+
405
+ // insert the check as far forward as possible into the BB
406
+ for (auto & I : *checkBB)
407
+ {
408
+ IP = &I;
409
+
410
+ if (isa<TraceRaySyncProceedHLIntrinsic>(&I))
411
+ break ;
412
+ }
413
+
404
414
IRB.SetInsertPoint (IP);
405
415
406
416
auto * load = IRB.CreateLoad (guard, VALUE_NAME (" RQGuardValue" ));
@@ -416,9 +426,19 @@ bool DynamicRayManagementPass::TryProceedBasedApproach(Function& F)
416
426
guardStoresAndLoads.push_back (IRB.CreateStore (IRB.getTrue (), guard));
417
427
};
418
428
419
- for (auto * insertBB : releaseBBs)
429
+ for (auto * releaseBB : releaseBBs)
420
430
{
421
- auto * IP = insertBB->getTerminator ();
431
+ auto * IP = releaseBB->getTerminator ();
432
+
433
+ // insert the release as far back as possible into the BB
434
+ for (auto & I : llvm::reverse (*releaseBB))
435
+ {
436
+ if (isa<TraceRaySyncProceedHLIntrinsic>(&I) || isa<PHINode>(&I))
437
+ break ;
438
+
439
+ IP = &I;
440
+ }
441
+
422
442
IRB.SetInsertPoint (IP);
423
443
424
444
auto * cond = IRB.CreateLoad (guard, VALUE_NAME (" RQGuardValue" ));
You can’t perform that action at this time.
0 commit comments