MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / Apply

Method Apply

source/fuzz/transformation_replace_irrelevant_id.cpp:98–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98void TransformationReplaceIrrelevantId::Apply(
99 opt::IRContext* ir_context,
100 TransformationContext* /* transformation_context */) const {
101 // Find the instruction.
102 auto instruction_to_change =
103 FindInstructionContainingUse(message_.id_use_descriptor(), ir_context);
104
105 // Replace the instruction.
106 instruction_to_change->SetInOperand(
107 message_.id_use_descriptor().in_operand_index(),
108 {message_.replacement_id()});
109
110 ir_context->get_def_use_mgr()->EraseUseRecordsOfOperandIds(
111 instruction_to_change);
112 ir_context->get_def_use_mgr()->AnalyzeInstUse(instruction_to_change);
113
114 // No analyses need to be invalidated, since the transformation is local to a
115 // block, and the def-use analysis has been updated.
116}
117
118protobufs::Transformation TransformationReplaceIrrelevantId::ToMessage() const {
119 protobufs::Transformation result;

Callers

nothing calls this directly

Calls 5

SetInOperandMethod · 0.80
AnalyzeInstUseMethod · 0.80
get_def_use_mgrMethod · 0.45

Tested by

no test coverage detected