mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-12-24 00:40:14 +00:00
spirv-fuzz: Allow inapplicable transformations to be ignored (#4407)
spirv-fuzz features transformations that should be applicable by construction. Assertions are used to detect when such transformations turn out to be inapplicable. Failures of such assertions indicate bugs in the fuzzer. However, when using the fuzzer at scale (e.g. in ClusterFuzz) reports of these assertion failures create noise, and cause the fuzzer to exit early. This change adds an option whereby inapplicable transformations can be ignored. This reduces noise and allows fuzzing to continue even when a transformation that should be applicable but is not has been erroneously created.
This commit is contained in:
parent
c9e094cc4d
commit
9c4481419e
@ -110,7 +110,8 @@ Fuzzer::Fuzzer(std::unique_ptr<opt::IRContext> ir_context,
|
||||
bool enable_all_passes,
|
||||
RepeatedPassStrategy repeated_pass_strategy,
|
||||
bool validate_after_each_fuzzer_pass,
|
||||
spv_validator_options validator_options)
|
||||
spv_validator_options validator_options,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: consumer_(std::move(consumer)),
|
||||
enable_all_passes_(enable_all_passes),
|
||||
validate_after_each_fuzzer_pass_(validate_after_each_fuzzer_pass),
|
||||
@ -124,7 +125,9 @@ Fuzzer::Fuzzer(std::unique_ptr<opt::IRContext> ir_context,
|
||||
pass_instances_(),
|
||||
repeated_pass_recommender_(nullptr),
|
||||
repeated_pass_manager_(nullptr),
|
||||
final_passes_() {
|
||||
final_passes_(),
|
||||
ignore_inapplicable_transformations_(
|
||||
ignore_inapplicable_transformations) {
|
||||
assert(ir_context_ && "IRContext is not initialized");
|
||||
assert(fuzzer_context_ && "FuzzerContext is not initialized");
|
||||
assert(transformation_context_ && "TransformationContext is not initialized");
|
||||
@ -257,7 +260,8 @@ void Fuzzer::MaybeAddRepeatedPass(uint32_t percentage_chance_of_adding_pass,
|
||||
fuzzer_context_->ChoosePercentage(percentage_chance_of_adding_pass)) {
|
||||
pass_instances->SetPass(MakeUnique<FuzzerPassT>(
|
||||
ir_context_.get(), transformation_context_.get(), fuzzer_context_.get(),
|
||||
&transformation_sequence_out_, std::forward<Args>(extra_args)...));
|
||||
&transformation_sequence_out_, ignore_inapplicable_transformations_,
|
||||
std::forward<Args>(extra_args)...));
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,7 +271,8 @@ void Fuzzer::MaybeAddFinalPass(std::vector<std::unique_ptr<FuzzerPass>>* passes,
|
||||
if (enable_all_passes_ || fuzzer_context_->ChooseEven()) {
|
||||
passes->push_back(MakeUnique<FuzzerPassT>(
|
||||
ir_context_.get(), transformation_context_.get(), fuzzer_context_.get(),
|
||||
&transformation_sequence_out_, std::forward<Args>(extra_args)...));
|
||||
&transformation_sequence_out_, ignore_inapplicable_transformations_,
|
||||
std::forward<Args>(extra_args)...));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,8 @@ class Fuzzer {
|
||||
const std::vector<fuzzerutil::ModuleSupplier>& donor_suppliers,
|
||||
bool enable_all_passes, RepeatedPassStrategy repeated_pass_strategy,
|
||||
bool validate_after_each_fuzzer_pass,
|
||||
spv_validator_options validator_options);
|
||||
spv_validator_options validator_options,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
// Disables copy/move constructor/assignment operations.
|
||||
Fuzzer(const Fuzzer&) = delete;
|
||||
@ -187,6 +188,12 @@ class Fuzzer {
|
||||
// Some passes that it does not make sense to apply repeatedly, as they do not
|
||||
// unlock other passes.
|
||||
std::vector<std::unique_ptr<FuzzerPass>> final_passes_;
|
||||
|
||||
// When set, this flag causes inapplicable transformations that should be
|
||||
// applicable by construction to be ignored. This is useful when the fuzzer
|
||||
// is being deployed at scale to test a SPIR-V processing tool, and where it
|
||||
// is desirable to ignore bugs in the fuzzer itself.
|
||||
const bool ignore_inapplicable_transformations_;
|
||||
};
|
||||
|
||||
} // namespace fuzz
|
||||
|
@ -43,11 +43,14 @@ namespace fuzz {
|
||||
FuzzerPass::FuzzerPass(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: ir_context_(ir_context),
|
||||
transformation_context_(transformation_context),
|
||||
fuzzer_context_(fuzzer_context),
|
||||
transformations_(transformations) {}
|
||||
transformations_(transformations),
|
||||
ignore_inapplicable_transformations_(
|
||||
ignore_inapplicable_transformations) {}
|
||||
|
||||
FuzzerPass::~FuzzerPass() = default;
|
||||
|
||||
@ -183,9 +186,23 @@ void FuzzerPass::ForEachInstructionWithInstructionDescriptor(
|
||||
}
|
||||
|
||||
void FuzzerPass::ApplyTransformation(const Transformation& transformation) {
|
||||
assert(transformation.IsApplicable(GetIRContext(),
|
||||
*GetTransformationContext()) &&
|
||||
"Transformation should be applicable by construction.");
|
||||
if (ignore_inapplicable_transformations_) {
|
||||
// If an applicable-by-construction transformation turns out to be
|
||||
// inapplicable, this is a bug in the fuzzer. However, when deploying the
|
||||
// fuzzer at scale for finding bugs in SPIR-V processing tools it is
|
||||
// desirable to silently ignore such bugs. This code path caters for that
|
||||
// scenario.
|
||||
if (!transformation.IsApplicable(GetIRContext(),
|
||||
*GetTransformationContext())) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// This code path caters for debugging bugs in the fuzzer, where an
|
||||
// applicable-by-construction transformation turns out to be inapplicable.
|
||||
assert(transformation.IsApplicable(GetIRContext(),
|
||||
*GetTransformationContext()) &&
|
||||
"Transformation should be applicable by construction.");
|
||||
}
|
||||
transformation.Apply(GetIRContext(), GetTransformationContext());
|
||||
auto transformation_message = transformation.ToMessage();
|
||||
assert(transformation_message.transformation_case() !=
|
||||
|
@ -33,7 +33,8 @@ class FuzzerPass {
|
||||
FuzzerPass(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
virtual ~FuzzerPass();
|
||||
|
||||
@ -321,6 +322,10 @@ class FuzzerPass {
|
||||
TransformationContext* transformation_context_;
|
||||
FuzzerContext* fuzzer_context_;
|
||||
protobufs::TransformationSequence* transformations_;
|
||||
// If set, then transformations that should be applicable by construction are
|
||||
// still tested for applicability, and ignored if they turn out to be
|
||||
// inapplicable. Otherwise, applicability by construction is asserted.
|
||||
const bool ignore_inapplicable_transformations_;
|
||||
};
|
||||
|
||||
} // namespace fuzz
|
||||
|
@ -23,9 +23,10 @@ namespace fuzz {
|
||||
FuzzerPassAddAccessChains::FuzzerPassAddAccessChains(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddAccessChains::Apply() {
|
||||
ForEachInstructionWithInstructionDescriptor(
|
||||
|
@ -28,7 +28,8 @@ class FuzzerPassAddAccessChains : public FuzzerPass {
|
||||
FuzzerPassAddAccessChains(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -24,9 +24,10 @@ namespace fuzz {
|
||||
FuzzerPassAddBitInstructionSynonyms::FuzzerPassAddBitInstructionSynonyms(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddBitInstructionSynonyms::Apply() {
|
||||
for (auto& function : *GetIRContext()->module()) {
|
||||
|
@ -28,7 +28,8 @@ class FuzzerPassAddBitInstructionSynonyms : public FuzzerPass {
|
||||
FuzzerPassAddBitInstructionSynonyms(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -26,9 +26,10 @@ namespace fuzz {
|
||||
FuzzerPassAddCompositeExtract::FuzzerPassAddCompositeExtract(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddCompositeExtract::Apply() {
|
||||
std::vector<const protobufs::DataDescriptor*> composite_synonyms;
|
||||
|
@ -27,7 +27,8 @@ class FuzzerPassAddCompositeExtract : public FuzzerPass {
|
||||
FuzzerPassAddCompositeExtract(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -25,9 +25,10 @@ namespace fuzz {
|
||||
FuzzerPassAddCompositeInserts::FuzzerPassAddCompositeInserts(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddCompositeInserts::Apply() {
|
||||
ForEachInstructionWithInstructionDescriptor(
|
||||
|
@ -27,7 +27,8 @@ class FuzzerPassAddCompositeInserts : public FuzzerPass {
|
||||
FuzzerPassAddCompositeInserts(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -24,9 +24,10 @@ namespace fuzz {
|
||||
FuzzerPassAddCompositeTypes::FuzzerPassAddCompositeTypes(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddCompositeTypes::Apply() {
|
||||
MaybeAddMissingVectorTypes();
|
||||
|
@ -27,7 +27,8 @@ class FuzzerPassAddCompositeTypes : public FuzzerPass {
|
||||
FuzzerPassAddCompositeTypes(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -25,9 +25,10 @@ namespace fuzz {
|
||||
FuzzerPassAddCopyMemory::FuzzerPassAddCopyMemory(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddCopyMemory::Apply() {
|
||||
ForEachInstructionWithInstructionDescriptor(
|
||||
|
@ -27,7 +27,8 @@ class FuzzerPassAddCopyMemory : public FuzzerPass {
|
||||
FuzzerPassAddCopyMemory(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -31,9 +31,10 @@ const size_t kMaxTransformationsInOnePass = 100U;
|
||||
FuzzerPassAddDeadBlocks::FuzzerPassAddDeadBlocks(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddDeadBlocks::Apply() {
|
||||
// We iterate over all blocks in the module collecting up those at which we
|
||||
|
@ -27,7 +27,8 @@ class FuzzerPassAddDeadBlocks : public FuzzerPass {
|
||||
FuzzerPassAddDeadBlocks(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -24,9 +24,10 @@ namespace fuzz {
|
||||
FuzzerPassAddDeadBreaks::FuzzerPassAddDeadBreaks(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddDeadBreaks::Apply() {
|
||||
// We first collect up lots of possibly-applicable transformations.
|
||||
|
@ -26,7 +26,8 @@ class FuzzerPassAddDeadBreaks : public FuzzerPass {
|
||||
FuzzerPassAddDeadBreaks(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -24,9 +24,10 @@ namespace fuzz {
|
||||
FuzzerPassAddDeadContinues::FuzzerPassAddDeadContinues(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddDeadContinues::Apply() {
|
||||
// Consider every block in every function.
|
||||
|
@ -23,10 +23,11 @@ namespace fuzz {
|
||||
// A fuzzer pass for adding dead continue edges to the module.
|
||||
class FuzzerPassAddDeadContinues : public FuzzerPass {
|
||||
public:
|
||||
FuzzerPassAddDeadContinues(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
FuzzerPassAddDeadContinues(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -45,9 +45,10 @@ bool IsBitWidthSupported(opt::IRContext* ir_context, uint32_t bit_width) {
|
||||
FuzzerPassAddEquationInstructions::FuzzerPassAddEquationInstructions(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddEquationInstructions::Apply() {
|
||||
ForEachInstructionWithInstructionDescriptor(
|
||||
|
@ -29,7 +29,8 @@ class FuzzerPassAddEquationInstructions : public FuzzerPass {
|
||||
FuzzerPassAddEquationInstructions(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -26,9 +26,10 @@ namespace fuzz {
|
||||
FuzzerPassAddFunctionCalls::FuzzerPassAddFunctionCalls(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddFunctionCalls::Apply() {
|
||||
ForEachInstructionWithInstructionDescriptor(
|
||||
|
@ -24,10 +24,11 @@ namespace fuzz {
|
||||
// anywhere, and (b) any functions, from dead blocks.
|
||||
class FuzzerPassAddFunctionCalls : public FuzzerPass {
|
||||
public:
|
||||
FuzzerPassAddFunctionCalls(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
FuzzerPassAddFunctionCalls(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -23,9 +23,10 @@ namespace fuzz {
|
||||
FuzzerPassAddGlobalVariables::FuzzerPassAddGlobalVariables(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddGlobalVariables::Apply() {
|
||||
SpvStorageClass variable_storage_class = SpvStorageClassPrivate;
|
||||
|
@ -27,7 +27,8 @@ class FuzzerPassAddGlobalVariables : public FuzzerPass {
|
||||
FuzzerPassAddGlobalVariables(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -27,9 +27,10 @@ FuzzerPassAddImageSampleUnusedComponents::
|
||||
opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddImageSampleUnusedComponents::Apply() {
|
||||
// SPIR-V module to help understand the transformation.
|
||||
|
@ -28,7 +28,8 @@ class FuzzerPassAddImageSampleUnusedComponents : public FuzzerPass {
|
||||
FuzzerPassAddImageSampleUnusedComponents(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -23,9 +23,10 @@ namespace fuzz {
|
||||
FuzzerPassAddLoads::FuzzerPassAddLoads(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddLoads::Apply() {
|
||||
ForEachInstructionWithInstructionDescriptor(
|
||||
|
@ -26,7 +26,8 @@ class FuzzerPassAddLoads : public FuzzerPass {
|
||||
FuzzerPassAddLoads(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -24,9 +24,10 @@ namespace fuzz {
|
||||
FuzzerPassAddLocalVariables::FuzzerPassAddLocalVariables(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddLocalVariables::Apply() {
|
||||
auto basic_type_ids_and_pointers =
|
||||
|
@ -27,7 +27,8 @@ class FuzzerPassAddLocalVariables : public FuzzerPass {
|
||||
FuzzerPassAddLocalVariables(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -23,9 +23,10 @@ namespace fuzz {
|
||||
FuzzerPassAddLoopPreheaders::FuzzerPassAddLoopPreheaders(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddLoopPreheaders::Apply() {
|
||||
for (auto& function : *GetIRContext()->module()) {
|
||||
|
@ -30,7 +30,8 @@ class FuzzerPassAddLoopPreheaders : public FuzzerPass {
|
||||
FuzzerPassAddLoopPreheaders(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -29,9 +29,10 @@ FuzzerPassAddLoopsToCreateIntConstantSynonyms::
|
||||
opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddLoopsToCreateIntConstantSynonyms::Apply() {
|
||||
std::vector<uint32_t> constants;
|
||||
|
@ -28,7 +28,8 @@ class FuzzerPassAddLoopsToCreateIntConstantSynonyms : public FuzzerPass {
|
||||
FuzzerPassAddLoopsToCreateIntConstantSynonyms(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -22,9 +22,10 @@ namespace fuzz {
|
||||
FuzzerPassAddNoContractionDecorations::FuzzerPassAddNoContractionDecorations(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddNoContractionDecorations::Apply() {
|
||||
// Consider every instruction in every block in every function.
|
||||
|
@ -26,7 +26,8 @@ class FuzzerPassAddNoContractionDecorations : public FuzzerPass {
|
||||
FuzzerPassAddNoContractionDecorations(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -23,9 +23,10 @@ namespace fuzz {
|
||||
FuzzerPassAddOpPhiSynonyms::FuzzerPassAddOpPhiSynonyms(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddOpPhiSynonyms::Apply() {
|
||||
// Get a list of synonymous ids with the same type that can be used in the
|
||||
|
@ -25,10 +25,11 @@ namespace fuzz {
|
||||
// synonymous with the others.
|
||||
class FuzzerPassAddOpPhiSynonyms : public FuzzerPass {
|
||||
public:
|
||||
FuzzerPassAddOpPhiSynonyms(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
FuzzerPassAddOpPhiSynonyms(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -25,9 +25,10 @@ namespace fuzz {
|
||||
FuzzerPassAddParameters::FuzzerPassAddParameters(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddParameters::Apply() {
|
||||
// Compute type candidates for the new parameter.
|
||||
|
@ -30,7 +30,8 @@ class FuzzerPassAddParameters : public FuzzerPass {
|
||||
FuzzerPassAddParameters(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -22,9 +22,10 @@ namespace fuzz {
|
||||
FuzzerPassAddRelaxedDecorations::FuzzerPassAddRelaxedDecorations(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddRelaxedDecorations::Apply() {
|
||||
// Consider every instruction in every block in every function.
|
||||
|
@ -26,7 +26,8 @@ class FuzzerPassAddRelaxedDecorations : public FuzzerPass {
|
||||
FuzzerPassAddRelaxedDecorations(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -23,9 +23,10 @@ namespace fuzz {
|
||||
FuzzerPassAddStores::FuzzerPassAddStores(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddStores::Apply() {
|
||||
ForEachInstructionWithInstructionDescriptor(
|
||||
|
@ -28,7 +28,8 @@ class FuzzerPassAddStores : public FuzzerPass {
|
||||
FuzzerPassAddStores(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -25,9 +25,10 @@ namespace fuzz {
|
||||
FuzzerPassAddSynonyms::FuzzerPassAddSynonyms(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddSynonyms::Apply() {
|
||||
ForEachInstructionWithInstructionDescriptor(
|
||||
|
@ -27,7 +27,8 @@ class FuzzerPassAddSynonyms : public FuzzerPass {
|
||||
FuzzerPassAddSynonyms(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -24,9 +24,10 @@ namespace fuzz {
|
||||
FuzzerPassAddVectorShuffleInstructions::FuzzerPassAddVectorShuffleInstructions(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAddVectorShuffleInstructions::Apply() {
|
||||
ForEachInstructionWithInstructionDescriptor(
|
||||
|
@ -26,7 +26,8 @@ class FuzzerPassAddVectorShuffleInstructions : public FuzzerPass {
|
||||
FuzzerPassAddVectorShuffleInstructions(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -24,9 +24,10 @@ namespace fuzz {
|
||||
FuzzerPassAdjustBranchWeights::FuzzerPassAdjustBranchWeights(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAdjustBranchWeights::Apply() {
|
||||
// For all OpBranchConditional instructions,
|
||||
|
@ -28,7 +28,8 @@ class FuzzerPassAdjustBranchWeights : public FuzzerPass {
|
||||
FuzzerPassAdjustBranchWeights(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -22,9 +22,10 @@ namespace fuzz {
|
||||
FuzzerPassAdjustFunctionControls::FuzzerPassAdjustFunctionControls(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAdjustFunctionControls::Apply() {
|
||||
// Consider every function in the module.
|
||||
|
@ -26,7 +26,8 @@ class FuzzerPassAdjustFunctionControls : public FuzzerPass {
|
||||
FuzzerPassAdjustFunctionControls(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -22,9 +22,10 @@ namespace fuzz {
|
||||
FuzzerPassAdjustLoopControls::FuzzerPassAdjustLoopControls(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAdjustLoopControls::Apply() {
|
||||
// Consider every merge instruction in the module (via looking through all
|
||||
|
@ -26,7 +26,8 @@ class FuzzerPassAdjustLoopControls : public FuzzerPass {
|
||||
FuzzerPassAdjustLoopControls(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -23,9 +23,10 @@ namespace fuzz {
|
||||
FuzzerPassAdjustMemoryOperandsMasks::FuzzerPassAdjustMemoryOperandsMasks(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAdjustMemoryOperandsMasks::Apply() {
|
||||
// Consider every block in every function.
|
||||
|
@ -27,7 +27,8 @@ class FuzzerPassAdjustMemoryOperandsMasks : public FuzzerPass {
|
||||
FuzzerPassAdjustMemoryOperandsMasks(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -22,9 +22,10 @@ namespace fuzz {
|
||||
FuzzerPassAdjustSelectionControls::FuzzerPassAdjustSelectionControls(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassAdjustSelectionControls::Apply() {
|
||||
// Consider every merge instruction in the module (via looking through all
|
||||
|
@ -26,7 +26,8 @@ class FuzzerPassAdjustSelectionControls : public FuzzerPass {
|
||||
FuzzerPassAdjustSelectionControls(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -28,9 +28,10 @@ namespace fuzz {
|
||||
FuzzerPassApplyIdSynonyms::FuzzerPassApplyIdSynonyms(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassApplyIdSynonyms::Apply() {
|
||||
// Compute a closure of data synonym facts, to enrich the pool of synonyms
|
||||
|
@ -28,7 +28,8 @@ class FuzzerPassApplyIdSynonyms : public FuzzerPass {
|
||||
FuzzerPassApplyIdSynonyms(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -26,9 +26,10 @@ namespace fuzz {
|
||||
FuzzerPassConstructComposites::FuzzerPassConstructComposites(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassConstructComposites::Apply() {
|
||||
// Gather up the ids of all composite types, but skip block-/buffer
|
||||
|
@ -29,7 +29,8 @@ class FuzzerPassConstructComposites : public FuzzerPass {
|
||||
FuzzerPassConstructComposites(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -24,9 +24,10 @@ namespace fuzz {
|
||||
FuzzerPassCopyObjects::FuzzerPassCopyObjects(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassCopyObjects::Apply() {
|
||||
ForEachInstructionWithInstructionDescriptor(
|
||||
|
@ -26,7 +26,8 @@ class FuzzerPassCopyObjects : public FuzzerPass {
|
||||
FuzzerPassCopyObjects(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -45,10 +45,11 @@ FuzzerPassDonateModules::FuzzerPassDonateModules(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations,
|
||||
const std::vector<fuzzerutil::ModuleSupplier>& donor_suppliers)
|
||||
bool ignore_inapplicable_transformations,
|
||||
std::vector<fuzzerutil::ModuleSupplier> donor_suppliers)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations),
|
||||
donor_suppliers_(donor_suppliers) {}
|
||||
transformations, ignore_inapplicable_transformations),
|
||||
donor_suppliers_(std::move(donor_suppliers)) {}
|
||||
|
||||
void FuzzerPassDonateModules::Apply() {
|
||||
// If there are no donor suppliers, this fuzzer pass is a no-op.
|
||||
|
@ -31,7 +31,8 @@ class FuzzerPassDonateModules : public FuzzerPass {
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations,
|
||||
const std::vector<fuzzerutil::ModuleSupplier>& donor_suppliers);
|
||||
bool ignore_inapplicable_transformations,
|
||||
std::vector<fuzzerutil::ModuleSupplier> donor_suppliers);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -25,9 +25,10 @@ FuzzerPassDuplicateRegionsWithSelections::
|
||||
opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassDuplicateRegionsWithSelections::Apply() {
|
||||
// Iterate over all of the functions in the module.
|
||||
|
@ -29,7 +29,8 @@ class FuzzerPassDuplicateRegionsWithSelections : public FuzzerPass {
|
||||
FuzzerPassDuplicateRegionsWithSelections(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -24,9 +24,10 @@ namespace fuzz {
|
||||
FuzzerPassExpandVectorReductions::FuzzerPassExpandVectorReductions(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassExpandVectorReductions::Apply() {
|
||||
for (auto& function : *GetIRContext()->module()) {
|
||||
|
@ -28,7 +28,8 @@ class FuzzerPassExpandVectorReductions : public FuzzerPass {
|
||||
FuzzerPassExpandVectorReductions(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -26,9 +26,10 @@ namespace fuzz {
|
||||
FuzzerPassFlattenConditionalBranches::FuzzerPassFlattenConditionalBranches(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassFlattenConditionalBranches::Apply() {
|
||||
for (auto& function : *GetIRContext()->module()) {
|
||||
|
@ -25,7 +25,8 @@ class FuzzerPassFlattenConditionalBranches : public FuzzerPass {
|
||||
FuzzerPassFlattenConditionalBranches(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -25,9 +25,10 @@ namespace fuzz {
|
||||
FuzzerPassInlineFunctions::FuzzerPassInlineFunctions(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassInlineFunctions::Apply() {
|
||||
// |function_call_instructions| are the instructions that will be inlined.
|
||||
|
@ -28,7 +28,8 @@ class FuzzerPassInlineFunctions : public FuzzerPass {
|
||||
FuzzerPassInlineFunctions(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -27,9 +27,10 @@ FuzzerPassInterchangeSignednessOfIntegerOperands::
|
||||
opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassInterchangeSignednessOfIntegerOperands::Apply() {
|
||||
assert(!GetFuzzerContext()->IsWgslCompatible() &&
|
||||
|
@ -32,7 +32,8 @@ class FuzzerPassInterchangeSignednessOfIntegerOperands : public FuzzerPass {
|
||||
FuzzerPassInterchangeSignednessOfIntegerOperands(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -25,9 +25,10 @@ namespace fuzz {
|
||||
FuzzerPassInterchangeZeroLikeConstants::FuzzerPassInterchangeZeroLikeConstants(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
uint32_t FuzzerPassInterchangeZeroLikeConstants::FindOrCreateToggledConstant(
|
||||
opt::Instruction* declaration) {
|
||||
|
@ -33,7 +33,8 @@ class FuzzerPassInterchangeZeroLikeConstants : public FuzzerPass {
|
||||
FuzzerPassInterchangeZeroLikeConstants(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -24,9 +24,10 @@ namespace fuzz {
|
||||
FuzzerPassInvertComparisonOperators::FuzzerPassInvertComparisonOperators(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassInvertComparisonOperators::Apply() {
|
||||
GetIRContext()->module()->ForEachInst([this](const opt::Instruction* inst) {
|
||||
|
@ -27,7 +27,8 @@ class FuzzerPassInvertComparisonOperators : public FuzzerPass {
|
||||
FuzzerPassInvertComparisonOperators(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -24,9 +24,10 @@ namespace fuzz {
|
||||
FuzzerPassMakeVectorOperationsDynamic::FuzzerPassMakeVectorOperationsDynamic(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassMakeVectorOperationsDynamic::Apply() {
|
||||
for (auto& function : *GetIRContext()->module()) {
|
||||
|
@ -27,7 +27,8 @@ class FuzzerPassMakeVectorOperationsDynamic : public FuzzerPass {
|
||||
FuzzerPassMakeVectorOperationsDynamic(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -24,9 +24,10 @@ namespace fuzz {
|
||||
FuzzerPassMergeBlocks::FuzzerPassMergeBlocks(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassMergeBlocks::Apply() {
|
||||
// First we populate a sequence of transformations that we might consider
|
||||
|
@ -26,7 +26,8 @@ class FuzzerPassMergeBlocks : public FuzzerPass {
|
||||
FuzzerPassMergeBlocks(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -26,9 +26,10 @@ namespace fuzz {
|
||||
FuzzerPassMergeFunctionReturns::FuzzerPassMergeFunctionReturns(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassMergeFunctionReturns::Apply() {
|
||||
// The pass might add new functions to the module (due to wrapping early
|
||||
|
@ -31,7 +31,8 @@ class FuzzerPassMergeFunctionReturns : public FuzzerPass {
|
||||
FuzzerPassMergeFunctionReturns(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -24,9 +24,10 @@ namespace fuzz {
|
||||
FuzzerPassMutatePointers::FuzzerPassMutatePointers(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassMutatePointers::Apply() {
|
||||
ForEachInstructionWithInstructionDescriptor(
|
||||
|
@ -26,7 +26,8 @@ class FuzzerPassMutatePointers : public FuzzerPass {
|
||||
FuzzerPassMutatePointers(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -30,9 +30,10 @@ namespace fuzz {
|
||||
FuzzerPassObfuscateConstants::FuzzerPassObfuscateConstants(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassObfuscateConstants::ObfuscateBoolConstantViaConstantPair(
|
||||
uint32_t depth, const protobufs::IdUseDescriptor& bool_constant_use,
|
||||
|
@ -30,7 +30,8 @@ class FuzzerPassObfuscateConstants : public FuzzerPass {
|
||||
FuzzerPassObfuscateConstants(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -27,9 +27,10 @@ namespace fuzz {
|
||||
FuzzerPassOutlineFunctions::FuzzerPassOutlineFunctions(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassOutlineFunctions::Apply() {
|
||||
std::vector<opt::Function*> original_functions;
|
||||
|
@ -24,10 +24,11 @@ namespace fuzz {
|
||||
// flow graph into their own functions.
|
||||
class FuzzerPassOutlineFunctions : public FuzzerPass {
|
||||
public:
|
||||
FuzzerPassOutlineFunctions(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
FuzzerPassOutlineFunctions(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
|
||||
|
@ -22,9 +22,10 @@ namespace fuzz {
|
||||
FuzzerPassPermuteBlocks::FuzzerPassPermuteBlocks(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassPermuteBlocks::Apply() {
|
||||
// For now we do something very simple: we randomly decide whether to move a
|
||||
|
@ -27,7 +27,8 @@ class FuzzerPassPermuteBlocks : public FuzzerPass {
|
||||
FuzzerPassPermuteBlocks(opt::IRContext* ir_context,
|
||||
TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
@ -28,9 +28,10 @@ namespace fuzz {
|
||||
FuzzerPassPermuteFunctionParameters::FuzzerPassPermuteFunctionParameters(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations)
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations)
|
||||
: FuzzerPass(ir_context, transformation_context, fuzzer_context,
|
||||
transformations) {}
|
||||
transformations, ignore_inapplicable_transformations) {}
|
||||
|
||||
void FuzzerPassPermuteFunctionParameters::Apply() {
|
||||
for (const auto& function : *GetIRContext()->module()) {
|
||||
|
@ -32,7 +32,8 @@ class FuzzerPassPermuteFunctionParameters : public FuzzerPass {
|
||||
FuzzerPassPermuteFunctionParameters(
|
||||
opt::IRContext* ir_context, TransformationContext* transformation_context,
|
||||
FuzzerContext* fuzzer_context,
|
||||
protobufs::TransformationSequence* transformations);
|
||||
protobufs::TransformationSequence* transformations,
|
||||
bool ignore_inapplicable_transformations);
|
||||
|
||||
void Apply() override;
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user