Skip to content

Commit e8c883e

Browse files
Address feedback
1 parent 124c098 commit e8c883e

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

lib/DxilPIXPasses/DxilDebugBreakInstrumentation.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,14 @@ bool DxilDebugBreakInstrumentation::runOnModule(Module &M) {
5757

5858
Function *DebugBreakFunc =
5959
HlslOP->GetOpFunc(OP::OpCode::DebugBreak, Type::getVoidTy(Ctx));
60-
for (auto UI = DebugBreakFunc->use_begin();
61-
UI != DebugBreakFunc->use_end();) {
62-
auto &Use = *UI++;
63-
DebugBreakCalls.push_back(cast<CallInst>(Use.getUser()));
60+
for (const Use &U : DebugBreakFunc->uses()) {
61+
DebugBreakCalls.push_back(cast<CallInst>(U.getUser()));
6462
}
6563

6664
for (CallInst *CI : DebugBreakCalls) {
67-
if (!PixUAVResource) {
65+
if (!PixUAVResource)
6866
PixUAVResource =
6967
PIXPassHelpers::CreateGlobalUAVResource(DM, 0, "PixUAVResource");
70-
}
7168

7269
Function *F = CI->getParent()->getParent();
7370

@@ -90,7 +87,7 @@ bool DxilDebugBreakInstrumentation::runOnModule(Module &M) {
9087

9188
uint32_t InstructionNumber = 0;
9289
if (!pix_dxil::PixDxilInstNum::FromInst(CI, &InstructionNumber)) {
93-
DXASSERT_NOMSG(false);
90+
DXASSERT(false, "Failed to extract PIX instruction number metadata from DebugBreak call");
9491
}
9592

9693
// The output UAV is treated as a bit array where each bit corresponds
@@ -122,8 +119,8 @@ bool DxilDebugBreakInstrumentation::runOnModule(Module &M) {
122119
CI->eraseFromParent();
123120
}
124121

125-
// Remove the now-unused dx.op.debugBreak function declaration so the
126-
// DebugBreak operation is fully eliminated from the module.
122+
// Clean up the now-unused declaration. Not strictly required for
123+
// correctness, but keeps the module free of dead references.
127124
if (DebugBreakFunc->use_empty())
128125
DebugBreakFunc->eraseFromParent();
129126

0 commit comments

Comments
 (0)