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

Method IsOpcodeSafeToDelete

source/opt/instruction.cpp:1053–1079  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1051}
1052
1053bool Instruction::IsOpcodeSafeToDelete() const {
1054 if (context()->IsCombinatorInstruction(this)) {
1055 return true;
1056 }
1057
1058 if (IsNonSemanticInstruction() &&
1059 (GetShaderDebugOpcode() == NonSemanticShaderDebugInfoDebugDeclare ||
1060 GetShaderDebugOpcode() == NonSemanticShaderDebugInfoDebugValue)) {
1061 return true;
1062 }
1063
1064 switch (opcode()) {
1065 case spv::Op::OpDPdx:
1066 case spv::Op::OpDPdy:
1067 case spv::Op::OpFwidth:
1068 case spv::Op::OpDPdxFine:
1069 case spv::Op::OpDPdyFine:
1070 case spv::Op::OpFwidthFine:
1071 case spv::Op::OpDPdxCoarse:
1072 case spv::Op::OpDPdyCoarse:
1073 case spv::Op::OpFwidthCoarse:
1074 case spv::Op::OpImageQueryLod:
1075 return true;
1076 default:
1077 return false;
1078 }
1079}
1080
1081bool Instruction::IsNonSemanticInstruction() const {
1082 if (!HasResultId()) return false;

Callers 1

InitializeWorkListMethod · 0.80

Calls 1

Tested by

no test coverage detected