Skip to content

Commit 73adf8c

Browse files
elvinw-inteligcbot
authored andcommitted
Minor improvements on ShaderDumpInstNamer
- Remove uncecessary counter++ - Support naming basic block to `bb0+`
1 parent 891413a commit 73adf8c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

IGC/common/LLVMUtils.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -795,11 +795,17 @@ void DumpLLVMIR(IGC::CodeGenContext* pContext, const char* dumpName)
795795
//from the ValueSymTab by overriding the x variable to _x
796796
for (auto& F : module->getFunctionList())
797797
for (BasicBlock& BB : F)
798+
{
798799
for (Instruction& I : BB)
799800
if (I.getName().startswith("x"))
800801
I.setName("_x");
802+
803+
if (BB.getName().startswith("bb"))
804+
BB.setName("_bb");
805+
}
801806
//Now we rewrite the variables using a counter
802807
unsigned int counter = 1;
808+
unsigned int bb_counter = 0;
803809
for (auto& F : module->getFunctionList())
804810
for (BasicBlock& BB : F)
805811
{
@@ -808,11 +814,12 @@ void DumpLLVMIR(IGC::CodeGenContext* pContext, const char* dumpName)
808814
if ((!I.hasName() && !I.getType()->isVoidTy()) ||
809815
I.getName().startswith("_x"))
810816
{
811-
I.setName("x" + std::to_string(counter));
812-
counter++;
817+
I.setName("x" + std::to_string(counter++));
813818
}
814819
}
815-
counter++;
820+
821+
if (!BB.hasName() || BB.getName().startswith("_bb"))
822+
BB.setName("bb" + std::to_string(bb_counter++));
816823
}
817824
}
818825

0 commit comments

Comments
 (0)