Skip to content

Commit fd031eb

Browse files
matborzyszkowskiigcbot
authored andcommitted
Skip dbg calls in non-simple loops for UnrollLoop
Skip dbg calls in non-simple loops for UnrollLoop
1 parent 8ccfb90 commit fd031eb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

IGC/Compiler/GenTTI.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,14 +383,15 @@ namespace llvm {
383383
if (L->getNumBlocks() != 1) {
384384
if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && IGCLLVM::isInnermost(L)) {
385385
auto countNonPHI = [](BasicBlock* BB) {
386-
unsigned Total = BB->size();
386+
// Count the number of instructions in the basic block without dbg instructions
387+
unsigned InstCountInBB = BB->sizeWithoutDebug();
387388
unsigned PHIs = 0;
388389
for (auto BI = BB->begin(), BE = BB->end(); BI != BE; ++BI) {
389390
if (!isa<PHINode>(&*BI))
390391
break;
391392
++PHIs;
392393
}
393-
return Total - PHIs;
394+
return InstCountInBB - PHIs;
394395
};
395396
auto hasLoad = [](BasicBlock* BB) {
396397
for (auto BI = BB->begin(), BE = BB->end(); BI != BE; ++BI)

0 commit comments

Comments
 (0)