spirv-fuzz: Remove duplicated functionality (#3220)
Fixes #3218.
diff --git a/source/fuzz/fuzzer_pass_add_function_calls.cpp b/source/fuzz/fuzzer_pass_add_function_calls.cpp
index 304f647..545aa16 100644
--- a/source/fuzz/fuzzer_pass_add_function_calls.cpp
+++ b/source/fuzz/fuzzer_pass_add_function_calls.cpp
@@ -62,8 +62,8 @@
std::vector<opt::Function*> candidate_functions;
for (auto& other_function : *GetIRContext()->module()) {
if (&other_function != function &&
- !TransformationFunctionCall::FunctionIsEntryPoint(
- GetIRContext(), other_function.result_id())) {
+ !fuzzerutil::FunctionIsEntryPoint(GetIRContext(),
+ other_function.result_id())) {
candidate_functions.push_back(&other_function);
}
}
diff --git a/source/fuzz/fuzzer_util.h b/source/fuzz/fuzzer_util.h
index ddc0d5a..7be0d59 100644
--- a/source/fuzz/fuzzer_util.h
+++ b/source/fuzz/fuzzer_util.h
@@ -162,8 +162,6 @@
opt::Function* FindFunction(opt::IRContext* ir_context, uint32_t function_id);
// Returns |true| if one of entry points has function id |function_id|.
-// TODO(https://github.com/KhronosGroup/SPIRV-Tools/issues/3218):
-// TransformationAddFunctionCall also has this functionality as a static method
bool FunctionIsEntryPoint(opt::IRContext* context, uint32_t function_id);
// Checks whether |id| is available (according to dominance rules) at the use
diff --git a/source/fuzz/transformation_function_call.cpp b/source/fuzz/transformation_function_call.cpp
index 6988664..cea8537 100644
--- a/source/fuzz/transformation_function_call.cpp
+++ b/source/fuzz/transformation_function_call.cpp
@@ -53,7 +53,7 @@
}
// The function must not be an entry point
- if (FunctionIsEntryPoint(context, message_.callee_id())) {
+ if (fuzzerutil::FunctionIsEntryPoint(context, message_.callee_id())) {
return false;
}
@@ -181,15 +181,5 @@
return result;
}
-bool TransformationFunctionCall::FunctionIsEntryPoint(opt::IRContext* context,
- uint32_t function_id) {
- for (auto& entry_point : context->module()->entry_points()) {
- if (entry_point.GetSingleWordInOperand(1) == function_id) {
- return true;
- }
- }
- return false;
-}
-
} // namespace fuzz
} // namespace spvtools
diff --git a/source/fuzz/transformation_function_call.h b/source/fuzz/transformation_function_call.h
index e977e1d..a9ae5be 100644
--- a/source/fuzz/transformation_function_call.h
+++ b/source/fuzz/transformation_function_call.h
@@ -55,10 +55,6 @@
protobufs::Transformation ToMessage() const override;
- // Helper to determine whether |function_id| is targeted by OpEntryPoint.
- static bool FunctionIsEntryPoint(opt::IRContext* context,
- uint32_t function_id);
-
private:
protobufs::TransformationFunctionCall message_;
};