These asserts are not valid for string literals, which may
contain several words:
assert(a_operand.words.size() == 1);
assert(b_operand.words.size() == 1);
It looks like they only make sense for the default case, which
assumes that both operands contain a single word.
Running a debug version of spirv-diff on any shader containing
a string literal will hit the original asserts.
A recent libc++ roll in Chrome warned of a deprecated copy. We're
still looking if this is a bug in libc++ or a valid warning, but
removing the redundant line is a safe workaround or fix in either
case.
See discussion in https://crrev.com/c/3791771
* spirv-as: Avoid overflow when parsing exponents on hex floats
When an exponent is so large that it would overflow the int
type in the parser, saturate the exponent.
This allows extremely large exponents, and saturates
to infinity when the exponent is positive, and zero when the exponent
is negative.
Fixes#4721.
* Avoid unexpected narrowing conversions from arithmetic operations
Co-authored-by: Alastair F. Donaldson <alastair.donaldson@imperial.ac.uk>
Excessive whitespace can lead to stack overflow during parsing as each
character of skipped whitespace involves a recursive call. An
iterative solution avoids this.
Fixes#4729.
This reverts commit d18d0d92e5.
This is reverted because it causes a 7X slowdown when legalizing
SPIR-V with NonSemantic.Shader.DebugInfo.100 instructions.
This is due to the creation of very large UseLists for several
heavily used operands for this extension combined with the fact
that the original commit changed the performance of Uselists to O(n).
Fix code that is traversing def-use user structure at the same time
that it is changing it. This is dicey at best and error prone at worst.
This was uncovered making a change to the id_to_user representation.
Fixes https://crbug.com/oss-fuzz48578
* Adds structural reachability to basic blocks
* calculated in same manner as reachability, but using structural
successors
* Change structured CFG validation to use structural reachability
instead of reachability
* Fix some invalid reducer cases
The fuzzer cretes code with very large array, and scalar replacement
times out. Adding a limit on the size of the composites that will be
split when fuzzing.
Fixes https://crbug.com/oss-fuzz/48630
Arrays do not have to have a size that is known at compile time. It
could be a spec constant. In these cases, treat the array
as if it is arbitrarily long. This commit will treat it like it is an
array of size UINT32_MAX.
Fixes https://crbug.com/oss-fuzz/47397.
If the `instruction` operand in an extended instruction instruction is
too large, it causes undefined behaviour when that value is cast to the
enum for the corresponding set. This is done with the
NonSemanticDebug100 instruction set. We need to avoid the undefined
behaviour.
Fixes#4727
Which functions are processed is determined by which ones are on the
call tree from the entry points before dead code is removed. So it is
possible that a function is process because it is called from an entry
point, but the CFG is not cleaned up because the call to the function
was removed.
The fix is to process and cleanup every function in the module. Since
all of the dead functions would have already been removed in an earlier
step of DCE, it should not make a different in compile time.
Fixes#4731
* ANGLE builds with -Werror,-Wunreachable-code-loop-increment which had
a problem with grabbing the first construct in a loop
* Change the code to just use begin instead
* Structural dominance introduced in SPIR-V 1.6 rev2
* Changes the structured cfg validation to use structural dominance
* structural dominance is based on a cfg where merge and continue
declarations are counted as graph edges
* Basic blocks now track structural predecessors and structural
successors
* Add validation for entry into a loop
* Fixed an issue with inlining a single block loop
* The continue target needs to be moved to the latch block
* Simplify the calculation of structured exits
* no longer requires block depth
* Update many invalid tests
We currently do not set stdout to binary mode when writing a binary
file on Windows. This cause some extra characters to be written that
mess up the output. We try to fix that.
Fixes#4793
When the `SPV_BINARY_TO_TEXT_OPTION_PRINT` option is specified, `spvtext` will not be created (see 37d2396cab/source/disassemble.cpp (L117)), and the attempt to dereference into its members (`spvtext->str` and `spvtext->length`) results in segmentation fault.
This is fixed by first checking if `spvtext` is nulll.
Co-authored-by: Steven Perron <stevenperron@google.com>
We currently build the structured order for all nodes reachable from the
loop header when unrolling a loop. However, unrolling only needs the
nodes in the loop and possibly the merge node.
To avoid needless computation, I have implemented a search that will
stop at the merge node.
Fixes#4827
Uses a preprocessor macro to bail out of unrolling loops with large
iteration counts during fuzzing, to reduce the number of
timeouts/memouts that arise.
Related issue: #4728.
The code in `CFG::SplitLoopHeader` assumes the loop header is not the
latch. This leads to it not being able to find the latch block. This
has been fixed, and a test added.
Fixes#4527
If the predecessor blocks are the same, then there is only 1 value for the
OpPhi. The simplition pass will simplify it, and it causes problems for
if-conversion. In these cases, if-conversion can just punt.
Fixes#3554.
There is an assert that verifies that the binary did not change when the
optimizer said that it did not. However, if the input binary is in big endian
format, the optimizer will encode the optimized binary in little endian. This
causes the assert to fail. Since we do not believe that anybody cares about a
big endien formate, we will disable the assert in that case.
Fixes#4722
The Reciprocal function expects a divide-by-0 to return nan,and then Reciprocal will return 0.
Since the divide-by-0 is actually undefined, we will identify this case early, and return 0.
No new tests are needed because we already tests folding divide-by-0.
Fixes#4715
An access chain could have a constant index that is an out of bounds
access. This is valid spir-v, even if it can cause problems at runtime.
However, it is not valid to have an OpCompositeExtract with an out of
bounds access. This means we have to stop local-access-chain-convert
from making that change.
Fixes#4605
A std::set is used instead of std::vector, where the elements are
ordered by member index first. Decorations for fields are now looked up
by going over the range of decorations for the member only, instead of
the whole set.
In an ANGLE test that generates a struct with 4096 members, validation
goes down from ~140ms to ~90ms. On debug builds, the difference is more
pronounced, going down from ~2.5s to ~600ms.
0c5616df9c...5723bb8950
$ git log 0c5616df9..5723bb895 --date=short --no-merges --format='%ad %ae %s'
2022-05-09 junyer Add GCC 12 to the build matrix.
2022-04-11 junyer Switch to `cxx_std_11` as per best current practice.
2022-04-08 junyer Mea culpa. The `DCHECK` needs to be an `if`.
2022-04-08 junyer Use `size_t` to stop MSVC griping about conversion.
2022-04-08 junyer `#include` `<cmath>` instead of `<math.h>`.
2022-04-06 junyer Prune `PrefilterTree` edges instead of nodes.
Created with:
roll-dep external/re2
25dcdc7e8b...548b13dc3c
$ git log 25dcdc7e8..548b13dc3 --date=short --no-merges --format='%ad %ae %s'
2022-05-31 absl-team Fix internal files
2022-05-30 jacobsa gmock-spec-builders: remove the name for an unused parameter.
2022-05-27 jacobsa gmock-spec-builders: add support for non-moveable types.
2022-05-27 elixir Clarify that `this->` is needed to access members of type-parameterized tests.
2022-05-27 jacobsa gmock-actions: properly support non-moveable results in `is_callable_r`.
2022-05-26 jacobsa gmock-spec-builders: move a method to the header.
2022-05-25 absl-team Update GoogleTest documentation's spelling of "GoogleTest".
2022-05-24 absl-team Clarify the pitfalls of EXPECT_THAT and highlight it's best practices
2022-05-17 dinor gmock-internal-utils.cc: Avoid implicit conversion from int to char Fixes#3832
2022-05-12 jacobsa gmock-actions: add support for move-only values to Return.
2022-05-12 absl-team Add clarifying comments about when to use EXPECT_NONFATAL_FAILURE vs. EXPECT_FATAL_FAILURE.
2022-05-11 jacobsa gmock-actions: provide a const reference when converting in ReturnAction.
2022-05-10 absl-team Do a consistent way of searching for a temporary directory.
2022-05-10 jacobsa gmock-actions: simplify Return and add better documentation.
2022-05-10 jacobsa gmock-actions: make OnceAction public.
2022-05-10 absl-team Fixup some missing overrides in googletest.
2022-05-03 absl-team Fix example of DescribeMatcher to properly support negation.
2022-05-02 absl-team Use TEST_TMPDIR on MacOS as well if available.
2022-05-02 jacobsa gmock-actions: remove a no-longer-necessary friend declaration.
2022-05-02 jacobsa gmock-actions: support ByMove in a specialization of ReturnAction.
2022-04-30 ayush854032 Fix typo in the test name of `NormalizeTest`
2022-04-28 absl-team Rewrite "Testing a Certain Property of an Object" as "Defining a Custom Matcher Class", and fix the code examples.
2022-04-27 jacobsa gmock-actions: improve comments and tests for the implicit cast in Return.
2022-04-26 jacobsa Support move-only and &&-qualified actions in WithArgs.
2022-04-26 dmauro Use RE2 for the regex implementation when building with Bazel and using Abseil
2022-04-26 absl-team Generalize gmock-matchers_test to handle is_gtest_matcher-style matchers, too.
2022-04-26 jacobsa Support move-only and &&-qualified actions in DoAll.
2022-04-22 dmauro Remove the legacy internal GTEST_DISALLOW_* macros
2022-04-21 dmauro Eliminate the legacy GTEST_COMPILE_ASSERT_ macro
2022-04-20 mhommey Always initialize fields in MatcherBase constructors
2022-04-13 jacobsa Document two surprises in `DoAllAction::NonFinalType`.
2022-04-13 absl-team Replace infinite recursion call (intentionally invoking undefined behavior to indicate unreachability) with explicit unreachability marker.
2022-04-08 absl-team Add support for move-only and &&-qualified actions in WillOnce.
2022-04-06 52797899+MR-A0101 Removing commas.
2022-04-06 dmauro Clarify what live-at-head actually means
2022-04-04 absl-team Trying to make it more clear: this is probably not about mock classes, but about mocked classes
2022-04-04 absl-team gmock: improve SFINAE for actions involving arguments.
2022-04-04 absl-team Use ResultOf()'s result_description when explaining match result.
Created with:
roll-dep external/googletest
This change adds a folding rule which transforms x * y - a and a - x * y
into FMA(x, y, -a) and FMA(-x, y, a), respectively.
While the SPIR-V instruction count remains the same, target instruction
sets typically feature FMA instruction variants that can negate an
operand. Also this transformation may unlock further optimizations which
eliminate the negation.
(Google bug: b/226145988)