Squashed 'third_party/SPIRV-Tools/' changes from b930e734e..54cd5e196
54cd5e196 spirv-opt : SPV_NV_bindless_texture related changes (#4870)
b5d0bf285 Require ColMajor or RowMajor for matrices (#4878)
a90ccc240 Remove default copy constructor in header. (#4879)
4773879b6 Update structure layout validation (#4876)
8dc0030ec spirv-as: Avoid overflow when parsing exponents on hex floats (#4874)
cc5fca057 spirv-val: Fix Vulkan memory scope (#4869)
388ce0ee6 spirv-as: Avoid recursion when skipping whitespace (#4866)
e4cfa190d spirv-val: Add SPV_KHR_ray_query (#4848)
60615b8ec Implement SPV_NV_bindless_texture related changes (#4847)
93ebf698a spirv-val: Add OpConvertUToAccelerationStructureKHR (#4838)
e2cf76930 spirv-val: Label VUID 06925 (#4852)
faa8d6a65 Revert "Optimize DefUseManager allocations (#4709)" (#4846)
69e1deabc Fix small bug traversing users in interface_var_sroa (#4850)
bc5c8760a spirv-val: Add Vulkan decoration interface (#4831)
05de65037 Use structural reachability in CFG checks (#4849)
dcee3a5de Update validator diagnostics with "structurally dominated" (#4844)
5f4284aa7 Add limit for scalar replacment when fuzzing (#4843)
92fe420c8 Reduce load size does not work for array with spec const size (#4845)
d5a3bfcf2 Avoid undefined behaviour when getting debug opcode (#4842)
6803cc512 use exec_tools instead of tools for better RBE compatibility (#4837)
32622ba7c DCE: clean up the cfg for all functions that were processed. (#4840)
8ec4a0772 Fix unreachable loop increment (#4836)
286e9c118 Use structural dominance to validate cfg (#4832)
91572e769 Write binary files to stdout in binary on windows. (#4834)
0b824324b Fix segfault in `SpirvTools::Disassemble` when printing (#4833)
66d88508d Build struct order only for the section needed when unrolling. (#4830)
f2dfa53ae Avoid unrolling large loops while fuzzing (#4835)
37d2396ca Fix SplitLoopHeader to handle single block loop (#4829)
3c9fd7577 Avoid if-conversion if both predecessors are the same (#4826)
c4ed5157d Fixed crash unrolling loops with residual iterations (#4820)
76fe35219 Fail validation when RelaxedPrecision is applied to a type. (#4823)
845d98d46 Do not check if the binary changed if encoding is different (#4824)
4f321f862 Avoid undefined divide-by-0 (#4821)
2eff41e70 Remove stray output to stdout from tests (#4816)
fbcb6cf4c Ability to fold Constant Vector times Matrix and Matrix times vector instructions (#4818)
bfc611b03 spirv-val: Label 06807 and 06808 VUID (#4817)
76ebfb989 Avoid replacing access chain with OOB access (#4819)
8f7f5024f Simplify invocation of snprintf (#4815)
fad68a755 Fix usage of sprintf. (#4811)
044ff1aab spirv-val: Add support for SPV_AMD_shader_early_and_late_fragment_tests (#4812)
c94501352 spirv-val: Optimize struct field decoration lookup (#4809)
git-subtree-dir: third_party/SPIRV-Tools
git-subtree-split: 54cd5e1963b399e6c6d3c5b70da45583d9f9fed8
Change-Id: I3bf0848ac96c1aee7cf29d9428babe18b52af105
diff --git a/source/opt/optimizer.cpp b/source/opt/optimizer.cpp
index 2976151..381589b 100644
--- a/source/opt/optimizer.cpp
+++ b/source/opt/optimizer.cpp
@@ -623,10 +623,16 @@
assert(optimized_binary_with_nop.size() == original_binary_size &&
"Binary size unexpectedly changed despite the optimizer saying "
"there was no change");
- assert(memcmp(optimized_binary_with_nop.data(), original_binary,
- original_binary_size) == 0 &&
- "Binary content unexpectedly changed despite the optimizer saying "
- "there was no change");
+
+ // Compare the magic number to make sure the binaries were encoded in the
+ // endianness. If not, the contents of the binaries will be different, so
+ // do not check the contents.
+ if (optimized_binary_with_nop[0] == original_binary[0]) {
+ assert(memcmp(optimized_binary_with_nop.data(), original_binary,
+ original_binary_size) == 0 &&
+ "Binary content unexpectedly changed despite the optimizer saying "
+ "there was no change");
+ }
}
#endif // !NDEBUG