Squashed 'third_party/SPIRV-Tools/' changes from fd773eb50d6..55af3902fc2
55af3902fc2 Fix function use (#3372)
9cb2571a184 spirv-val: allow DebugInfoNone for DebugTypeComposite.Size (#3374)
4386ef4234e Add validation support for ImageGatherBiasLodAMD (#3363)
b0264b87ffb Fix validation failure on OpDecorationGroup (#3365)
4410272bdda Remove deprecated interfaces from instrument passes (#3361)
50b15578866 Preserve debug info in inline pass (#3349)
4dbe18b0c86 Reject folding comparisons with unfoldable types. (#3370)
55193b06e5e Improve build instructions for fuzzer (#3364)
3c47dac2820 Add unrolling to performance passes (#3082)
2b987c49a4e Handle OpConstantNull in ssa-rewrite (#3362)
95df4c9643c Add in a bunch of missed files to the BUILD.gn (#3360)
90930cb3115 Remove stale entries from BUILD.gn (#3358)
18ba3d9a353 allow cross compiling for Windows Store, UWP, etc. (#3330)
2f69ea849aa spirv-fuzz: Remove FuzzerPassAddUsefulConstructs (#3341)
522561619a9 Add support for StorageBuffer (#3348)
b75dbf82a69 Prevent Effcee install his things when build spirv-tools with testing enabled (#3256)
85c7e7956bf Don't register edges twice in merge return (#3350)
bd0a2da946c Revert "Revert "[spirv-opt] refactor inlining pass (#3328)" (#3342)" (#3345)
31182763704 spirv-reduce: Remove unused struct members (#3329)
a6b0e132ecc Add adjust branch weights transformation (#3336)
d4fac3451b7 Revert "[spirv-opt] refactor inlining pass (#3328)" (#3342)
233246bc9c5 [spirv-opt] refactor inlining pass (#3328)
2992386ebea spirv-reduce: Remove unused uniforms and similar (#3321)
a9f2a145e65 spirv-fuzz: Fix to fact manager (#3339)
045a26e6e37 spirv-fuzz: Get rid of unnecessary template method (#3340)
63fa9114a93 Do merge return if the return is not at the end of the function. (#3337)
c8590c18bd0 Preserve debug info for wrap-opkill (#3331)
d2b48621949 Validate ShaderCallKHR memory scope (#3332)
2e1d208ed9d spirv-fuzz: Do not allow adding stores to read-only pointers (#3316)
54fb17b2d30 reduce: increase default step limit (#3327)
49842b88eec Generalize IsReadOnlyVariable() to apply to pointers (#3325)
49ca250b44c Delete nullptr in function bb list immedietly (#3326)
d0a87194f7b Set DebugScope for termination instructions (#3323)
f278b467dfd spirv-fuzz: Do not outline regions that end with a loop header (#3312)
23d68608b00 vscode: Handle '|' chains on BitEnum / ValueEnum (#3309)
42268740c95 Add debug information analysis (#3305)
eed48ae479d Add spvtools::opt::Operand::AsLiteralUint64 (#3320)
94d6002dc53 spirv-fuzz: Pass on validator options during shrinking (#3317)
88faf63ad3c spirv-fuzz: Clamp statically out-of-bounds accesses in code donation (#3315)
b74199a22d4 spirv-fuzz: Fix memory management in the fact manager (#3313)
d158ffe5405 spirv-fuzz: Do not replace the Sample argument in OpImageTexelPointer (#3311)
5547553a0c7 Allow various validation options to be passed to spirv-opt (#3314)
30ffe62e257 typo fix: in README.md exectuable->executable (#3306)
67f4838659f spirv-fuzz: Make handling of synonym facts more efficient (#3301)
61b7de3c39f Remove unreachable code. (#3304)
ed96301c6c4 spirv-fuzz: Fix to outliner (#3302)
c018fc6ae66 spirv-fuzz: Do not outline regions that produce pointer outputs (#3291)
f460cca9dca spirv-fuzz: Handle OpRuntimeArray when replacing ids with synonyms (#3292)
2f180468a71 spirv-fuzz: Handle image storage class in donation (#3290)
f82d47003e7 spirv-fuzz: Respect rules for OpSampledImage (#3287)
7ce2db1763b spirv-fuzz: Fix comment. (#3300)
7d65bce0bbe Sampled images as read-only storage (#3295)
2a2bdbd5d72 Remove implicit fallthrough (#3298)
49566448944 Add tests for recently added command line option (#3297)
ca5751590ed If SPIRV-Headers is in our tree, include it as subproject (#3299)
e70d25f6fa5 Struct CFG analysus and single block loop (#3293)
000040e707a Preserve debug info in eliminate-dead-functions (#3251)
c531099eb34 Update acorn version (#3294)
34be23373b9 Handle more cases in dead member elim (#3289)
d0490ef080c Fix pch macro to ignore clang-cl (#3283)
538512e8e89 spirv-fuzz: Improve the handling of equation facts (#3281)
183e3242a36 spirv-fuzz: Handle more general SPIR-V in donation (#3280)
4af38c49bfe spirv-fuzz: Improve support for compute shaders in donation (#3277)
e95fbfb1f50 spirv-fuzz: Transformation to add OpConstantNull (#3273)
5d491a7ed66 spirv-fuzz: Handle isomorphic types property in composite construction (#3262)
bfd25ace084 spirv-fuzz: Limit adding of new variables to 'basic' types (#3257)
f28cdeff16f spirv-fuzz: Only replace regular ids with synonyms (#3255)
8d4261bc440 spirv-fuzz: Introduce TransformationContext (#3272)
2fdea57d19d spirv-fuzz: Add validator options (#3254)
af01d57b5e3 Update dominates to check for null nodes (#3271)
f20c0d7971c Set wrapped kill basic block's parent (#3269)
c37c94929bf Validate Buffer and BufferBlock apply only to struct types (#3259)
git-subtree-dir: third_party/SPIRV-Tools
git-subtree-split: 55af3902fc24db889b0ef8010a83efca04a6352c
diff --git a/test/fuzz/transformation_composite_extract_test.cpp b/test/fuzz/transformation_composite_extract_test.cpp
index 5cc2115..a7674a6 100644
--- a/test/fuzz/transformation_composite_extract_test.cpp
+++ b/test/fuzz/transformation_composite_extract_test.cpp
@@ -96,100 +96,103 @@
ASSERT_TRUE(IsValid(env, context.get()));
FactManager fact_manager;
+ spvtools::ValidatorOptions validator_options;
+ TransformationContext transformation_context(&fact_manager,
+ validator_options);
// Instruction does not exist.
ASSERT_FALSE(TransformationCompositeExtract(
MakeInstructionDescriptor(36, SpvOpIAdd, 0), 200, 101, {0})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
// Id for composite is not a composite.
ASSERT_FALSE(TransformationCompositeExtract(
MakeInstructionDescriptor(36, SpvOpIAdd, 0), 200, 27, {})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
// Composite does not dominate instruction being inserted before.
ASSERT_FALSE(
TransformationCompositeExtract(
MakeInstructionDescriptor(37, SpvOpAccessChain, 0), 200, 101, {0})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
// Too many indices for extraction from struct composite.
ASSERT_FALSE(
TransformationCompositeExtract(
MakeInstructionDescriptor(24, SpvOpAccessChain, 0), 200, 101, {0, 0})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
// Too many indices for extraction from struct composite.
ASSERT_FALSE(
TransformationCompositeExtract(
MakeInstructionDescriptor(13, SpvOpIEqual, 0), 200, 104, {0, 0, 0})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
// Out of bounds index for extraction from struct composite.
ASSERT_FALSE(
TransformationCompositeExtract(
MakeInstructionDescriptor(13, SpvOpIEqual, 0), 200, 104, {0, 3})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
// Result id already used.
ASSERT_FALSE(TransformationCompositeExtract(
MakeInstructionDescriptor(35, SpvOpFAdd, 0), 80, 103, {0})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
TransformationCompositeExtract transformation_1(
MakeInstructionDescriptor(36, SpvOpConvertFToS, 0), 201, 100, {2});
- ASSERT_TRUE(transformation_1.IsApplicable(context.get(), fact_manager));
- transformation_1.Apply(context.get(), &fact_manager);
+ ASSERT_TRUE(
+ transformation_1.IsApplicable(context.get(), transformation_context));
+ transformation_1.Apply(context.get(), &transformation_context);
ASSERT_TRUE(IsValid(env, context.get()));
TransformationCompositeExtract transformation_2(
MakeInstructionDescriptor(37, SpvOpAccessChain, 0), 202, 104, {0, 2});
- ASSERT_TRUE(transformation_2.IsApplicable(context.get(), fact_manager));
- transformation_2.Apply(context.get(), &fact_manager);
+ ASSERT_TRUE(
+ transformation_2.IsApplicable(context.get(), transformation_context));
+ transformation_2.Apply(context.get(), &transformation_context);
ASSERT_TRUE(IsValid(env, context.get()));
TransformationCompositeExtract transformation_3(
MakeInstructionDescriptor(29, SpvOpAccessChain, 0), 203, 104, {0});
- ASSERT_TRUE(transformation_3.IsApplicable(context.get(), fact_manager));
- transformation_3.Apply(context.get(), &fact_manager);
+ ASSERT_TRUE(
+ transformation_3.IsApplicable(context.get(), transformation_context));
+ transformation_3.Apply(context.get(), &transformation_context);
ASSERT_TRUE(IsValid(env, context.get()));
TransformationCompositeExtract transformation_4(
MakeInstructionDescriptor(24, SpvOpStore, 0), 204, 101, {0});
- ASSERT_TRUE(transformation_4.IsApplicable(context.get(), fact_manager));
- transformation_4.Apply(context.get(), &fact_manager);
+ ASSERT_TRUE(
+ transformation_4.IsApplicable(context.get(), transformation_context));
+ transformation_4.Apply(context.get(), &transformation_context);
ASSERT_TRUE(IsValid(env, context.get()));
TransformationCompositeExtract transformation_5(
MakeInstructionDescriptor(29, SpvOpBranch, 0), 205, 102, {2});
- ASSERT_TRUE(transformation_5.IsApplicable(context.get(), fact_manager));
- transformation_5.Apply(context.get(), &fact_manager);
+ ASSERT_TRUE(
+ transformation_5.IsApplicable(context.get(), transformation_context));
+ transformation_5.Apply(context.get(), &transformation_context);
ASSERT_TRUE(IsValid(env, context.get()));
TransformationCompositeExtract transformation_6(
MakeInstructionDescriptor(37, SpvOpReturn, 0), 206, 103, {1});
- ASSERT_TRUE(transformation_6.IsApplicable(context.get(), fact_manager));
- transformation_6.Apply(context.get(), &fact_manager);
+ ASSERT_TRUE(
+ transformation_6.IsApplicable(context.get(), transformation_context));
+ transformation_6.Apply(context.get(), &transformation_context);
ASSERT_TRUE(IsValid(env, context.get()));
- ASSERT_TRUE(fact_manager.IsSynonymous(MakeDataDescriptor(201, {}),
- MakeDataDescriptor(100, {2}),
- context.get()));
- ASSERT_TRUE(fact_manager.IsSynonymous(MakeDataDescriptor(202, {}),
- MakeDataDescriptor(104, {0, 2}),
- context.get()));
- ASSERT_TRUE(fact_manager.IsSynonymous(MakeDataDescriptor(203, {}),
- MakeDataDescriptor(104, {0}),
- context.get()));
- ASSERT_TRUE(fact_manager.IsSynonymous(MakeDataDescriptor(204, {}),
- MakeDataDescriptor(101, {0}),
- context.get()));
- ASSERT_TRUE(fact_manager.IsSynonymous(MakeDataDescriptor(205, {}),
- MakeDataDescriptor(102, {2}),
- context.get()));
- ASSERT_TRUE(fact_manager.IsSynonymous(MakeDataDescriptor(206, {}),
- MakeDataDescriptor(103, {1}),
- context.get()));
+ ASSERT_TRUE(transformation_context.GetFactManager()->IsSynonymous(
+ MakeDataDescriptor(201, {}), MakeDataDescriptor(100, {2})));
+ ASSERT_TRUE(transformation_context.GetFactManager()->IsSynonymous(
+ MakeDataDescriptor(202, {}), MakeDataDescriptor(104, {0, 2})));
+ ASSERT_TRUE(transformation_context.GetFactManager()->IsSynonymous(
+ MakeDataDescriptor(203, {}), MakeDataDescriptor(104, {0})));
+ ASSERT_TRUE(transformation_context.GetFactManager()->IsSynonymous(
+ MakeDataDescriptor(204, {}), MakeDataDescriptor(101, {0})));
+ ASSERT_TRUE(transformation_context.GetFactManager()->IsSynonymous(
+ MakeDataDescriptor(205, {}), MakeDataDescriptor(102, {2})));
+ ASSERT_TRUE(transformation_context.GetFactManager()->IsSynonymous(
+ MakeDataDescriptor(206, {}), MakeDataDescriptor(103, {1})));
std::string after_transformation = R"(
OpCapability Shader
@@ -348,49 +351,52 @@
ASSERT_TRUE(IsValid(env, context.get()));
FactManager fact_manager;
+ spvtools::ValidatorOptions validator_options;
+ TransformationContext transformation_context(&fact_manager,
+ validator_options);
// Cannot insert before the OpVariables of a function.
ASSERT_FALSE(
TransformationCompositeExtract(
MakeInstructionDescriptor(101, SpvOpVariable, 0), 200, 14, {0})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
ASSERT_FALSE(
TransformationCompositeExtract(
MakeInstructionDescriptor(101, SpvOpVariable, 1), 200, 14, {1})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
ASSERT_FALSE(
TransformationCompositeExtract(
MakeInstructionDescriptor(102, SpvOpVariable, 0), 200, 14, {1})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
// OK to insert right after the OpVariables.
ASSERT_FALSE(TransformationCompositeExtract(
MakeInstructionDescriptor(102, SpvOpBranch, 1), 200, 14, {1})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
// Cannot insert before the OpPhis of a block.
ASSERT_FALSE(TransformationCompositeExtract(
MakeInstructionDescriptor(60, SpvOpPhi, 0), 200, 14, {2})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
ASSERT_FALSE(TransformationCompositeExtract(
MakeInstructionDescriptor(59, SpvOpPhi, 0), 200, 14, {3})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
// OK to insert after the OpPhis.
ASSERT_TRUE(
TransformationCompositeExtract(
MakeInstructionDescriptor(59, SpvOpAccessChain, 0), 200, 14, {3})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
// Cannot insert before OpLoopMerge
ASSERT_FALSE(TransformationCompositeExtract(
MakeInstructionDescriptor(33, SpvOpBranchConditional, 0),
200, 14, {3})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
// Cannot insert before OpSelectionMerge
ASSERT_FALSE(TransformationCompositeExtract(
MakeInstructionDescriptor(21, SpvOpBranchConditional, 0),
200, 14, {2})
- .IsApplicable(context.get(), fact_manager));
+ .IsApplicable(context.get(), transformation_context));
}
} // namespace