Skip to content

Commit dd37e5b

Browse files
Kotynia, Piotrigcbot
authored andcommitted
This change makes sure that MemOpt pass calculate identical distance
value for instructions in debug and nondebug optimization. This was required because in some cases MemOpt passes was creating different code for identical code in debug and non debug version.
1 parent a84b40a commit dd37e5b

File tree

2 files changed

+391
-0
lines changed

2 files changed

+391
-0
lines changed

IGC/Compiler/CISACodeGen/MemOpt.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,14 @@ bool MemOpt::runOnFunction(Function& F) {
482482
unsigned Distance = 0;
483483
for (auto BI = BB->begin(), BE = BB->end(); BI != BE; ++BI, ++Distance) {
484484
Instruction* I = &(*BI);
485+
486+
// Make sure we don't count debug info intrinsincs
487+
// This is required to keep debug and non-debug optimizations identical
488+
if (isDbgIntrinsic(I)) {
489+
Distance--;
490+
continue;
491+
}
492+
485493
// Skip irrelevant instructions.
486494
if (shouldSkip(I))
487495
continue;

0 commit comments

Comments
 (0)