Don't emit debug instructions before an OpPhi

Nonsemantic instructions aren't allowed before an OpPhi, so don't emit
line and debug scope instructions when the instruction being emitted is
an OpPhi.
This commit is contained in:
Arcady Goldmints-Orlov 2024-07-22 17:20:14 -04:00 committed by arcady-lunarg
parent 74d448cc15
commit 592aed9c20
3 changed files with 228 additions and 224 deletions

View file

@ -2131,6 +2131,12 @@ void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decorat
}
void Builder::addInstruction(std::unique_ptr<Instruction> inst) {
// Phis must appear first in their block, don't insert line tracking instructions
// in front of them, just add the OpPhi and return.
if (inst->getOpCode() == OpPhi) {
buildPoint->addInstruction(std::move(inst));
return;
}
// Optionally insert OpDebugScope
if (emitNonSemanticShaderDebugInfo && dirtyScopeTracker) {
if (buildPoint->updateDebugScope(currentDebugScopeId.top())) {